summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-07-15 11:26:30 -0500
committerCase Duckworth2022-07-15 11:26:30 -0500
commit0d6d58999899831edb313b0b4988cc7286ffcc8d (patch)
treea163f3bd8b6026f0d67b8ed2054e85929e0e9268 /lisp
parent2022-07-11 (diff)
downloademacs-0d6d58999899831edb313b0b4988cc7286ffcc8d.tar.gz
emacs-0d6d58999899831edb313b0b4988cc7286ffcc8d.zip
meh
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+apheleia.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/+apheleia.el b/lisp/+apheleia.el index 9ed731c..3428a72 100644 --- a/lisp/+apheleia.el +++ b/lisp/+apheleia.el
@@ -3,6 +3,7 @@
3;;; Code: 3;;; Code:
4 4
5(require 'cl-lib) 5(require 'cl-lib)
6(require 'user-save)
6 7
7;; https://github.com/raxod502/apheleia/pull/63#issue-1077529623 8;; https://github.com/raxod502/apheleia/pull/63#issue-1077529623
8(cl-defun +apheleia-indent-region (&key buffer scratch formatter callback &allow-other-keys) 9(cl-defun +apheleia-indent-region (&key buffer scratch formatter callback &allow-other-keys)
@@ -13,5 +14,18 @@
13 (point-max)) 14 (point-max))
14 (funcall callback))) 15 (funcall callback)))
15 16
17(define-minor-mode +apheleia/user-save-mode
18 "Minor mode for reformatting code on `user-save'.
19Customize with `apheleia-mode-alist' and `apheleia-formatters'."
20 :lighter " Apheleia/US"
21 (if +apheleia/user-save-mode
22 (add-hook 'user-save-hook #'apheleia--format-after-save nil 'local)
23 (remove-hook 'user-save-hook #'apheleia--format-after-save 'local)))
24
25(define-globalized-minor-mode +apheleia/user-save-global-mode
26 +apheleia/user-save-mode +apheleia/user-save-mode)
27
28(put '+apheleia/user-save-mode 'safe-local-variable #'booleanp)
29
16(provide '+apheleia) 30(provide '+apheleia)
17;;; +apheleia.el ends here 31;;; +apheleia.el ends here