Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support for formatting Emacs Lisp by reindenting it #68

Closed
c02y opened this issue Dec 30, 2021 · 6 comments
Closed

Add support for formatting Emacs Lisp by reindenting it #68

c02y opened this issue Dec 30, 2021 · 6 comments

Comments

@c02y
Copy link

c02y commented Dec 30, 2021

No description provided.

@c02y
Copy link
Author

c02y commented Dec 30, 2021

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.

raxod502 added a commit that referenced this issue Jan 3, 2022
@raxod502
Copy link
Member

raxod502 commented Jan 3, 2022

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?

@c02y
Copy link
Author

c02y commented Jan 3, 2022

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

@c02y
Copy link
Author

c02y commented Jan 3, 2022

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))

@raxod502
Copy link
Member

raxod502 commented Jan 4, 2022

I suppose it would be okay to add Elisp; this should be doable using #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 lassik/emacs-format-all-the-code#170, which I just filed.

@raxod502 raxod502 changed the title Doesn't support emacs-lisp-mode? Add support for formatting Emacs Lisp by reindenting it Jan 4, 2022
@mohkale
Copy link
Contributor

mohkale commented Apr 20, 2023

I think this can be closed, there's now a lisp-indent formatter available. Please reopen if still necessary.

@mohkale mohkale closed this as completed Apr 20, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

3 participants