docs(format): clarify how to update macro in private config

This commit is contained in:
Ellis Kenyo 2023-09-14 16:44:43 +01:00 committed by Henrik Lissner
parent b58dc721aa
commit 0b2e6d7070
2 changed files with 14 additions and 1 deletions

View file

@ -68,6 +68,15 @@ provide a simple macro that looks like the below:
(set-formatter! 'unique-name '("command" "line" "here") :modes '(name-of-major-mode)) (set-formatter! 'unique-name '("command" "line" "here") :modes '(name-of-major-mode))
#+end_src #+end_src
If you're trying to override a formatter that has previously been defined by
Doom, you will need to ensure that the call in your config is contained within
an =after!= form, eg below to override Clojure's with =zprint=:
#+begin_src emacs-lisp
(after! clojure-mode
(set-formatter! 'zprint '("zprint" "-") :modes '(clojure-mode)))
#+end_src
There are a few bonus symbols that apheleia uses (for example =npx= will be There are a few bonus symbols that apheleia uses (for example =npx= will be
replaced by a correct path to npx) which are all documented in the link above. replaced by a correct path to npx) which are all documented in the link above.

View file

@ -4,7 +4,7 @@
(cl-defun set-formatter! (name args &key modes) (cl-defun set-formatter! (name args &key modes)
"Define (or modify) a formatter named NAME. "Define (or modify) a formatter named NAME.
Supported keywords: :modes :filter Supported keywords: :modes
NAME is a symbol that identifies this formatter. NAME is a symbol that identifies this formatter.
@ -20,6 +20,10 @@ nested list.
string and ARG is both a predicate and argument for STRING. If ARG is nil, string and ARG is both a predicate and argument for STRING. If ARG is nil,
STRING will be omitted from the vector. STRING will be omitted from the vector.
If you're trying to override this, ensure that you wrap the call in `after!' and
whichever package sets the initial formatter. See the ':editor format' README
for more.
For more information on how to structure the list to be For more information on how to structure the list to be
compatible, see `apheleia--run-formatter-function'. compatible, see `apheleia--run-formatter-function'.