about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el28
-rw-r--r--lisp/acdw-apheleia.el25
2 files changed, 37 insertions, 16 deletions
diff --git a/init.el b/init.el index c3cbb68..e294a95 100644 --- a/init.el +++ b/init.el
@@ -964,30 +964,26 @@ specific to most general, they are these:
964(setup (:straight (apheleia 964(setup (:straight (apheleia
965 :host github 965 :host github
966 :repo "raxod502/apheleia")) 966 :repo "raxod502/apheleia"))
967 967
968 (apheleia-global-mode +1) 968 (:also-load acdw-apheleia)
969 969 (add-hook 'before-save-hook #'apheleia-dumb-auto-format)
970 ;; Use a dumb formatter on modes that `apheleia' doesn't work for. 970
971 (add-hook 'before-save-hook 971 ;; Aphelia can't find prettier on Windows (though I
972 (defun before-save@dumb-auto-format () 972 ;; installed it, I think), and it keeps trying to start
973 (setq stupid-modes '(makefile-mode 973 ;; new processes until Emacs runs out of subprocess space.
974 org-mode)) 974 ;; So I just enable it at home.
975 ;; If there's no apheleia formatter for the mode, just indent the 975 (unless (acdw/system :work)
976 ;; buffer. 976 (apheleia-global-mode +1)))
977 (unless (or (apply #'derived-mode-p stupid-modes)
978 (and (fboundp 'apheleia--get-formatter-command)
979 (apheleia--get-formatter-command)))
980 (indent-region (point-min) (point-max))))))
981 977
982(setup (:straight async) 978(setup (:straight async)
983 (dired-async-mode +1)) 979 (dired-async-mode +1))
984 980
985(setup (:straight avy) 981(setup (:straight avy)
986 (:global "C-'" #'avy-goto-char-timer 982 (:global "M-j" #'avy-goto-char-timer
987 "C-c C-j" #'avy-resume) 983 "C-c C-j" #'avy-resume)
988 984
989 (:with-feature isearch 985 (:with-feature isearch
990 (:bind "C-'" #'avy-isearch))) 986 (:bind "M-j" #'avy-isearch)))
991 987
992(setup (:straight circe) 988(setup (:straight circe)
993 (require 'circe) 989 (require 'circe)
diff --git a/lisp/acdw-apheleia.el b/lisp/acdw-apheleia.el new file mode 100644 index 0000000..1b646ef --- /dev/null +++ b/lisp/acdw-apheleia.el
@@ -0,0 +1,25 @@
1;;; acdw-apheleia.el --- bespoke apheleia junk -*- lexical-binding: t -*-
2
3;;; Commentary:
4
5;;; Code:
6
7(require 'apheleia)
8
9(defcustom apheleia-stupid-modes '(makefile-mode
10 org-mode)
11 "List of stupid modes to not use `apheleia-global-mode' on."
12 :type '(repeat function)
13 :group 'apheleia)
14
15(defun apheleia-dumb-auto-format ()
16 "Format a buffer dumbly."
17 ;; If there's no apheleia formatter for the mode, just indent the
18 ;; buffer.
19 (unless (or (apply #'derived-mode-p apheleia-stupid-modes)
20 (and (fboundp 'apheleia--get-formatter-command)
21 (apheleia--get-formatter-command)))
22 (indent-region (point-min) (point-max))))
23
24(provide 'acdw-apheleia)
25;;; acdw-apheleia ends here