about summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
authorCase Duckworth2021-04-01 16:53:49 -0500
committerCase Duckworth2021-04-01 16:55:40 -0500
commite535ec0a4b55bebe5bc364c3379b964d5021bfd1 (patch)
tree5ace43755f9b36c15d73595b7adc91410da81c00 /init.el
parentBreak "Programming languages" out into its own section (diff)
downloademacs-e535ec0a4b55bebe5bc364c3379b964d5021bfd1.tar.gz
emacs-e535ec0a4b55bebe5bc364c3379b964d5021bfd1.zip
Add function `dumb-auto-format' that checks with apheleia first
In adding `dumb-auto-format', I've removed `acdw/reformat-buffer' because it's
not complex enough or stand-alone enough to keep as its own function.

21 guns.
Diffstat (limited to 'init.el')
-rw-r--r--init.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/init.el b/init.el index 0f235b3..023faa3 100644 --- a/init.el +++ b/init.el
@@ -729,14 +729,21 @@ if ripgrep is installed, otherwise `consult-grep'."
729;;;;; Formatting 729;;;;; Formatting
730(setup (:straight (apheleia :host github 730(setup (:straight (apheleia :host github
731 :repo "raxod502/apheleia")) 731 :repo "raxod502/apheleia"))
732 (apheleia-global-mode +1)) 732 (apheleia-global-mode +1)
733
734 ;; Use a dumb formatter on modes that `apheleia' doesn't work for.
735 (defun dumb-auto-format ()
736 "Run `indent-region' in buffers that don't have an
737 `apheleia' formatter set."
738 (unless (apheleia--get-formatter-command)
739 (indent-region (point-min) (point-max))))
740 (add-hook 'before-save-hook #'dumb-auto-format))
733 741
734;;;;; Emacs lisp 742;;;;; Emacs lisp
735(setup emacs-lisp-mode 743(setup emacs-lisp-mode
736 (:option eval-expression-print-length nil 744 (:option eval-expression-print-length nil
737 eval-expression-print-level nil 745 eval-expression-print-level nil
738 lisp-indent-function #'lisp-indent-function) 746 lisp-indent-function #'lisp-indent-function))
739 (:local-hook before-save-hook acdw/reindent-buffer))
740 747
741(setup (:straight macrostep) 748(setup (:straight macrostep)
742 (define-key emacs-lisp-mode-map (kbd "C-c e") #'macrostep-expand)) 749 (define-key emacs-lisp-mode-map (kbd "C-c e") #'macrostep-expand))