Variable: apheleia-mode-alist
apheleia-mode-alist is a customizable variable defined in
apheleia-formatters.el.
Value
Large value
((asm-mode . asmfmt) (awk-mode . gawk) (bash-ts-mode . shfmt)
(bazel-mode . buildifier) (beancount-mode . bean-format)
(bibtex-mode . bibtex) (c++-ts-mode . clang-format)
(caddyfile-mode . caddyfmt) (cc-mode . clang-format)
(c-mode . clang-format) (c-ts-mode . clang-format)
(c++-mode . clang-format) (caml-mode . ocamlformat)
(clojure-mode . cljfmt) (clojure-ts-mode . cljfmt)
(cmake-mode . cmake-format) (cmake-ts-mode . cmake-format)
(common-lisp-mode . lisp-indent) (conf-toml-mode . taplo)
(cperl-mode . perltidy) (crystal-mode . crystal-tool-format)
(csharp-mode . csharpier) (csharp-ts-mode . csharpier)
(css-mode . prettier-css) (css-ts-mode . prettier-css)
(dart-mode . dart-format) (dart-ts-mode . dart-format)
(dockerfile-mode . dprint) (dockerfile-ts-mode . dprint)
(elixir-mode . mix-format) (elixir-ts-mode . mix-format)
(elm-mode . elm-format) (emacs-lisp-mode . lisp-indent)
(fish-mode . fish-indent) (gdscript-mode . gdformat)
(gdscript-ts-mode . gdformat) (gleam-ts-mode . gleam)
(go-mode . gofmt) (go-ts-mode . gofmt)
(graphql-mode . prettier-graphql) (haskell-mode . fourmolu)
(haskell-ts-mode . fourmolu) (hcl-mode . hclfmt)
(html-mode . prettier-html) (html-ts-mode . prettier-html)
(hurl-mode . hurlfmt) (java-mode . google-java-format)
(java-ts-mode . google-java-format) (jinja2-mode)
(js3-mode . prettier-javascript) (js-json-mode . prettier-json)
(js-mode . prettier-javascript) (js-ts-mode . prettier-javascript)
(json-mode . prettier-json) (json-ts-mode . prettier-json)
(kotlin-mode . ktlint) (kotlin-ts-mode . ktlint)
(latex-mode . latexindent) (LaTeX-mode . latexindent)
(lua-mode . stylua) (lua-ts-mode . stylua) (lisp-mode . lisp-indent)
(meson-mode . meson) (nasm-mode . asmfmt)
(neocaml-interface-mode . ocamlformat) (neocaml-mode . ocamlformat)
(nix-mode . nixfmt) (nix-ts-mode . nixfmt) (nomad-mode . nomad)
(objc-mode . clang-format) ("\\.mm\\'" . clang-format)
(perl-mode . perltidy) (php-mode . phpcs) (php-ts-mode . phpcs)
(pkl-mode . pkl) (purescript-mode . purs-tidy) (python-mode . black)
(python-ts-mode . black) (robot-mode . robotidy)
(ruby-mode . prettier-ruby) (ruby-ts-mode . prettier-ruby)
(rustic-mode . rustfmt) (rust-mode . rustfmt)
(rust-ts-mode . rustfmt) (snakemake-mode . snakefmt)
(scss-mode . prettier-scss) (sql-mode . pgformatter)
(svelte-mode . prettier-svelte) (terraform-mode . opentofu)
(TeX-latex-mode . latexindent) (TeX-mode . latexindent)
(toml-ts-mode . taplo) (tsv-mode . yq-tsv)
(tsx-ts-mode . prettier-typescript) (tuareg-mode . ocamlformat)
(typescript-mode . prettier-typescript)
(typescript-ts-mode . prettier-typescript) (typst-mode . typstyle)
(typst-ts-mode . typstyle) (v-mode . vfmt) (web-mode . prettier)
(yaml-mode . prettier-yaml) (yaml-ts-mode . prettier-yaml)
(yang-mode . pyang) (zig-mode . zig-fmt) (zig-ts-mode . zig-fmt))
Documentation
Alist mapping major mode names to formatters to use in those modes.
This determines what formatter to use in buffers without a
setting for apheleia-formatter. The keys are major mode
symbols (matched against major-mode with derived-mode-p) or
strings (matched against value of variable buffer-file-name(var)/buffer-file-name(fun)
with string-match-p), and the values are symbols with entries
in apheleia-formatters (or equivalently, they are allowed
values for apheleia-formatter). Values can be a list of such
symbols causing each formatter in the list to be called one after
the other (with the output of the previous formatter).
Earlier entries in this variable take precedence over later ones.
Be careful when writing regexps to include "\\'" and to escape
"\\." in order to properly match a file extension. For example,
to match ".jsx" files you might use "\\.jsx\\'".
If a given mode derives from another mode (e.g. php-mode and
cc-mode), then whichever entry in the alist is more specific
will apply. In the case that multiple modes match
derived-mode-p for the current buffer but neither derives from
the other, whichever entry comes first will be used.
The value for a major mode can be nil (equivalently, an empty list). This means to use no formatter. This can be helpful in case your major mode derives from a more general one, but you don't want the more general formatter to apply to the derived mode.
Source Code
;; Defined in /nix/store/lwcwryzabcmvjcwwzzs65jrwf7p7d7cs-emacs-packages-deps/share/emacs/site-lisp/elpa/apheleia-20260915.1628/apheleia-formatters.el
(defcustom apheleia-mode-alist
'(;; Alphabetical please
(asm-mode . asmfmt)
(awk-mode . gawk)
(bash-ts-mode . shfmt)
(bazel-mode . buildifier)
(beancount-mode . bean-format)
(bibtex-mode . bibtex)
(c++-ts-mode . clang-format)
(caddyfile-mode . caddyfmt)
(cc-mode . clang-format)
(c-mode . clang-format)
(c-ts-mode . clang-format)
(c++-mode . clang-format)
(caml-mode . ocamlformat)
(clojure-mode . cljfmt)
(clojure-ts-mode . cljfmt)
(cmake-mode . cmake-format)
(cmake-ts-mode . cmake-format)
(common-lisp-mode . lisp-indent)
(conf-toml-mode . taplo)
(cperl-mode . perltidy)
(crystal-mode . crystal-tool-format)
(csharp-mode . csharpier)
(csharp-ts-mode . csharpier)
(css-mode . prettier-css)
(css-ts-mode . prettier-css)
(dart-mode . dart-format)
(dart-ts-mode . dart-format)
(dockerfile-mode . dprint)
(dockerfile-ts-mode . dprint)
(elixir-mode . mix-format)
(elixir-ts-mode . mix-format)
(elm-mode . elm-format)
(emacs-lisp-mode . lisp-indent)
(fish-mode . fish-indent)
(gdscript-mode . gdformat)
(gdscript-ts-mode . gdformat)
(gleam-ts-mode . gleam)
(go-mode . gofmt)
(go-ts-mode . gofmt)
(graphql-mode . prettier-graphql)
(haskell-mode . fourmolu)
(haskell-ts-mode . fourmolu)
(hcl-mode . hclfmt)
(html-mode . prettier-html)
(html-ts-mode . prettier-html)
(hurl-mode . hurlfmt)
(java-mode . google-java-format)
(java-ts-mode . google-java-format)
(jinja2-mode . nil)
(js3-mode . prettier-javascript)
(js-json-mode . prettier-json)
(js-mode . prettier-javascript)
(js-ts-mode . prettier-javascript)
(json-mode . prettier-json)
(json-ts-mode . prettier-json)
(kotlin-mode . ktlint)
(kotlin-ts-mode . ktlint)
(latex-mode . latexindent)
(LaTeX-mode . latexindent)
(lua-mode . stylua)
(lua-ts-mode . stylua)
(lisp-mode . lisp-indent)
;; markdown-mode not included because so many people format
;; markdown code in so many different ways and we don't want to
;; try imposing a standard by default
(meson-mode . meson)
(nasm-mode . asmfmt)
(neocaml-interface-mode . ocamlformat)
(neocaml-mode . ocamlformat)
(nix-mode . nixfmt)
(nix-ts-mode . nixfmt)
(nomad-mode . nomad)
(objc-mode . clang-format)
;; Emacs doesn't yet have a mode for Objective-C++
("\\.mm\\'" . clang-format)
(perl-mode . perltidy)
(php-mode . phpcs)
(php-ts-mode . phpcs)
(pkl-mode . pkl)
(purescript-mode . purs-tidy)
(python-mode . black)
(python-ts-mode . black)
(robot-mode . robotidy)
(ruby-mode . prettier-ruby)
(ruby-ts-mode . prettier-ruby)
(rustic-mode . rustfmt)
(rust-mode . rustfmt)
(rust-ts-mode . rustfmt)
(snakemake-mode . snakefmt)
(scss-mode . prettier-scss)
(sql-mode . pgformatter)
(svelte-mode . prettier-svelte)
(terraform-mode . opentofu)
(TeX-latex-mode . latexindent)
(TeX-mode . latexindent)
(toml-ts-mode . taplo)
(tsv-mode . yq-tsv)
(tsx-ts-mode . prettier-typescript)
(tuareg-mode . ocamlformat)
(typescript-mode . prettier-typescript)
(typescript-ts-mode . prettier-typescript)
(typst-mode . typstyle)
(typst-ts-mode . typstyle)
(v-mode . vfmt)
(web-mode . prettier)
(yaml-mode . prettier-yaml)
(yaml-ts-mode . prettier-yaml)
(yang-mode . pyang)
(zig-mode . zig-fmt)
(zig-ts-mode . zig-fmt))
"Alist mapping major mode names to formatters to use in those modes.
This determines what formatter to use in buffers without a
setting for `apheleia-formatter'. The keys are major mode
symbols (matched against `major-mode' with `derived-mode-p') or
strings (matched against value of variable `buffer-file-name'
with `string-match-p'), and the values are symbols with entries
in `apheleia-formatters' (or equivalently, they are allowed
values for `apheleia-formatter'). Values can be a list of such
symbols causing each formatter in the list to be called one after
the other (with the output of the previous formatter).
Earlier entries in this variable take precedence over later ones.
Be careful when writing regexps to include \"\\'\" and to escape
\"\\.\" in order to properly match a file extension. For example,
to match \".jsx\" files you might use \"\\.jsx\\'\".
If a given mode derives from another mode (e.g. `php-mode' and
`cc-mode'), then whichever entry in the alist is more specific
will apply. In the case that multiple modes match
`derived-mode-p' for the current buffer but neither derives from
the other, whichever entry comes first will be used.
The value for a major mode can be nil (equivalently, an empty
list). This means to use no formatter. This can be helpful in
case your major mode derives from a more general one, but you
don't want the more general formatter to apply to the derived
mode."
:type '(alist
:key-type
(choice (symbol :tag "Major mode")
(string :tag "Buffer name regexp"))
:value-type
(choice (symbol :tag "Formatter")
(repeat
(symbol :tag "Formatter"))))
:group 'apheleia)