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 Yann Esposito (Yogsototh)
parent 88a03663a6
commit 6b2a74094e
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
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))
#+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
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)
"Define (or modify) a formatter named NAME.
Supported keywords: :modes :filter
Supported keywords: :modes
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 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
compatible, see `apheleia--run-formatter-function'.