docs(format): set-formatter!: escape quotes in docstring

This commit is contained in:
Henrik Lissner 2023-09-14 17:29:41 +02:00
parent 0b2e6d7070
commit 3191349182
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -24,8 +24,8 @@ 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 whichever package sets the initial formatter. See the ':editor format' README
for more. 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
compatible, see `apheleia--run-formatter-function'. `apheleia--run-formatter-function'.
MODES is a major mode, a list thereof, or a list of two-element sublists with MODES is a major mode, a list thereof, or a list of two-element sublists with
the structure: (MAJOR-MODE FORM). FORM is evaluated when the buffer is formatted the structure: (MAJOR-MODE FORM). FORM is evaluated when the buffer is formatted
@ -37,42 +37,41 @@ and its return value serves two purposes:
list of shell arguments via the `mode-result' variable. list of shell arguments via the `mode-result' variable.
Basic examples: Basic examples:
(set-formatter! 'asmfmt \"asmfmt\" :modes '(asm-mode nasm-mode)) (set-formatter! \\='asmfmt \"asmfmt\" :modes \\='(asm-mode nasm-mode))
(set-formatter! 'black \"black -q -\") (set-formatter! \\='black \"black -q -\")
(set-formatter! 'html-tidy \"tidy -q -indent\" :modes '(html-mode web-mode)) (set-formatter! \\='html-tidy \"tidy -q -indent\" :modes \\='(html-mode web-mode))
Advanced examples: Advanced examples:
(set-formatter! (set-formatter!
'clang-format \\='clang-format
'(\"clang-format\" \\='(\"clang-format\"
(\"-assume-filename=%S\" (or buffer-file-name mode-result \"\"))) (\"-assume-filename=%S\" (or buffer-file-name mode-result \"\")))
:modes :modes
'((c-mode \".c\") \\='((c-mode \".c\")
(c++-mode \".cpp\") (c++-mode \".cpp\")
(java-mode \".java\") (java-mode \".java\")
(objc-mode \".m\") (objc-mode \".m\")
(protobuf-mode \".proto\"))) (protobuf-mode \".proto\")))
(set-formatter! 'html-tidy (set-formatter! \\='html-tidy
'(\"tidy\" \"-q\" \"-indent\" \\='(\"tidy\" \"-q\" \"-indent\"
(\"-xml\" (memq major-mode '(nxml-mode xml-mode)))) (\"-xml\" (memq major-mode \\='(nxml-mode xml-mode))))
:modes :modes
'(html-mode \\='(html-mode
(web-mode (and (equal \"none\" web-mode-engine) (web-mode (and (equal \"none\" web-mode-engine)
(car (member web-mode-content-type '(\"xml\" \"html\"))))))) (car (member web-mode-content-type \\='(\"xml\" \"html\")))))))
(set-formatter! 'html-tidy ; overwrite predefined html-tidy formatter (set-formatter! \\='html-tidy ; overwrite predefined html-tidy formatter
'(\"tidy\" \"-q\" \"-indent\" \\='(\"tidy\" \"-q\" \"-indent\"
\"--tidy-mark\" \"no\" \"--tidy-mark\" \"no\"
\"--drop-empty-elements\" \"no\" \"--drop-empty-elements\" \"no\"
\"--show-body-only\" \"auto\" \"--show-body-only\" \"auto\"
(\"--indent-spaces\" \"%d\" tab-width) (\"--indent-spaces\" \"%d\" tab-width)
(\"--indent-with-tabs\" \"%s\" (if indent-tabs-mode \"yes\" \"no\")) (\"--indent-with-tabs\" \"%s\" (if indent-tabs-mode \"yes\" \"no\"))
(\"-xml\" (memq major-mode '(nxml-mode xml-mode))))) (\"-xml\" (memq major-mode \\='(nxml-mode xml-mode)))))
(set-formatter! 'elm-format (set-formatter! \\='elm-format
\"elm-format --yes --stdin\") \"elm-format --yes --stdin\")"
"
(declare (indent defun)) (declare (indent defun))
(cl-check-type name symbol) (cl-check-type name symbol)
(after! apheleia-core (after! apheleia-core