apheleia
apheleia copied to clipboard
Add support for formatting Emacs Lisp by reindenting it
BTW:
Please add support for fish-shell script:
add this in apheleia-formatters:
(fish_indent . ("fish_indent"))
add this in apheleia-mode-alist:
(fish-mode . fish_indent)
so I don't have to make a PR.
I added fish-indent as requested, since the change was straightforward. However, it's unclear what Apheleia should do with Emacs Lisp code. Reindent it? Or run some more sophisticated formatter?
I didn't find a simple emacs-lisp-formatter, but emacs-format-all just creates a function to format the emacs-lisp buffer https://github.com/lassik/emacs-format-all-the-code/blob/master/format-all.el#L798-L808
What I recommended is to supported all the languages that emacs-format-all-the-code supports which is listed in https://github.com/lassik/emacs-format-all-the-code#supported-languages, sorry, maybe this is too much to make such a recommendation.
Angular/Vue (prettier)
Assembly (asmfmt)
ATS (atsfmt)
Awk (gawk)
Bazel Starlark (buildifier)
BibTeX (Emacs)
C/C++/Objective-C (clang-format, astyle)
C# (clang-format, astyle)
Cabal (cabal-fmt)
Clojure/ClojureScript (node-cljfmt)
CMake (cmake-format)
Crystal (crystal tool format)
CSS/Less/SCSS (prettier)
Cuda (clang-format)
D (dfmt)
Dart (dartfmt, dart-format)
Dhall (dhall format)
Dockerfile (dockfmt)
Elixir (mix format)
Elm (elm-format)
Emacs Lisp (Emacs)
F# (fantomas)
Fish Shell (fish_indent)
Fortran Free Form (fprettify)
Gleam (gleam format)
GLSL (clang-format)
Go (gofmt, goimports)
GraphQL (prettier)
Haskell (brittany, fourmolu, hindent, ormolu, stylish-haskell)
HTML/XHTML/XML (tidy)
Java (clang-format, astyle)
JavaScript/JSON/JSX (prettier, standard)
Jsonnet (jsonnetfmt)
Kotlin (ktlint)
LaTeX (latexindent, auctex)
Ledger (ledger-mode)
Lua (lua-fmt, prettier plugin)
Markdown (prettier)
Nginx (nginxfmt)
Nix (nixpkgs-fmt, nixfmt)
OCaml (ocp-indent)
Perl (perltidy)
PHP (prettier plugin)
Protocol Buffers (clang-format)
PureScript (purty, purescript-tidy)
Python (black, yapf)
R (styler)
Racket (raco fmt)
Reason (bsrefmt)
ReScript (rescript format)
Ruby (rubocop, rufo, standardrb)
Rust (rustfmt)
Scala (scalafmt)
Shell script (beautysh, shfmt)
Snakemake (snakefmt)
Solidity (prettier plugin)
SQL (pgformatter, sqlformat)
Svelte (prettier plugin)
Swift (swiftformat)
Terraform (terraform fmt)
TOML (prettier plugin)
TypeScript/TSX (prettier)
V (v fmt)
Verilog (iStyle)
YAML (prettier)
Currently apheleia only supports:
((cc-mode . clang-format)
(c-mode . clang-format)
(c++-mode . clang-format)
(css-mode . prettier)
(elixir-mode . mix-format)
(fish-mode . fish-indent)
(go-mode . gofmt)
(haskell-mode . brittany)
(html-mode . prettier)
(java-mode . google-java-format)
(js3-mode . prettier)
(js-mode . prettier)
(json-mode . prettier)
(latex-mode . latexindent)
(LaTeX-mode . latexindent)
(php-mode . nil)
(python-mode . black)
(ruby-mode . prettier)
(rustic-mode . rustfmt)
(rust-mode . rustfmt)
(sass-mode . prettier)
(terraform-mode . terraform)
(TeX-latex-mode . latexindent)
(TeX-mode . latexindent)
(tuareg-mode . ocamlformat)
(typescript-mode . prettier)
(web-mode . prettier)
(yaml-mode . prettier))
I suppose it would be okay to add Elisp; this should be doable using https://github.com/raxod502/apheleia/pull/63 that was recently merged. It would be best to open a separate issue about formatter parity with format-all-the-code, though. See also https://github.com/lassik/emacs-format-all-the-code/issues/170, which I just filed.
I think this can be closed, there's now a lisp-indent formatter available. Please reopen if still necessary.