Change apheleia stupid indenting

This commit is contained in:
Case Duckworth 2021-09-29 17:21:50 -05:00
parent b954ae483d
commit 0165cc6bfc
2 changed files with 36 additions and 15 deletions

26
init.el
View File

@ -964,30 +964,26 @@ specific to most general, they are these:
(setup (:straight (apheleia
:host github
:repo "raxod502/apheleia"))
(apheleia-global-mode +1)
;; Use a dumb formatter on modes that `apheleia' doesn't work for.
(add-hook 'before-save-hook
(defun before-save@dumb-auto-format ()
(setq stupid-modes '(makefile-mode
org-mode))
;; If there's no apheleia formatter for the mode, just indent the
;; buffer.
(unless (or (apply #'derived-mode-p stupid-modes)
(and (fboundp 'apheleia--get-formatter-command)
(apheleia--get-formatter-command)))
(indent-region (point-min) (point-max))))))
(:also-load acdw-apheleia)
(add-hook 'before-save-hook #'apheleia-dumb-auto-format)
;; Aphelia can't find prettier on Windows (though I
;; installed it, I think), and it keeps trying to start
;; new processes until Emacs runs out of subprocess space.
;; So I just enable it at home.
(unless (acdw/system :work)
(apheleia-global-mode +1)))
(setup (:straight async)
(dired-async-mode +1))
(setup (:straight avy)
(:global "C-'" #'avy-goto-char-timer
(:global "M-j" #'avy-goto-char-timer
"C-c C-j" #'avy-resume)
(:with-feature isearch
(:bind "C-'" #'avy-isearch)))
(:bind "M-j" #'avy-isearch)))
(setup (:straight circe)
(require 'circe)

25
lisp/acdw-apheleia.el Normal file
View File

@ -0,0 +1,25 @@
;;; acdw-apheleia.el --- bespoke apheleia junk -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(require 'apheleia)
(defcustom apheleia-stupid-modes '(makefile-mode
org-mode)
"List of stupid modes to not use `apheleia-global-mode' on."
:type '(repeat function)
:group 'apheleia)
(defun apheleia-dumb-auto-format ()
"Format a buffer dumbly."
;; If there's no apheleia formatter for the mode, just indent the
;; buffer.
(unless (or (apply #'derived-mode-p apheleia-stupid-modes)
(and (fboundp 'apheleia--get-formatter-command)
(apheleia--get-formatter-command)))
(indent-region (point-min) (point-max))))
(provide 'acdw-apheleia)
;;; acdw-apheleia ends here