about summary refs log tree commit diff stats
path: root/lisp/+apheleia.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/+apheleia.el')
-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