A call to `format-all--formatter-executable` with the formatter being
equal to `'lsp` or `'eglot` will return `nil`. Therefore, `funcall` was
never called in those cases.
This isn't the apheleia rewrite, just a redesign to fix the module's
current issues with its +onsave feature.
+ Rethinks how the formatter dispatches to lsp/eglot's formatter.
+ Stops format-all from being too imposing with its warnings.
+ Relies more on format-all-mode to control formatting-on-save.
+ Sidestep +format-buffer-a hackery when using lsp/eglot formatters.
Fixes#5121Fixes#5128Fixes#5133
The :editor format module uses either the formatter available through an
LSP server or a formatter that the format-all package supports. With
:editor (format +onsave), this formatter is triggered when a file is
saved. However, if no format-all formatter is available, this on-save
behavior is disabled, even if an LSP formatter is available. This fixes
that.
Should stop format-all's error from causing trouble in modes that don't
have a registered formatter, like mu4e, org-msg-edit-mode,
org-journal-mode, and others.
+ Change +format-type to +format-region-p (now a boolean)
+ Add PRESERVE-INDENT-P boolean argument to +format-buffer
+ Add +format-preserve-indentation variable (only controls indent
preservation during +format/buffer, not +format/region, where it's
always enabled).
+ Fix error arising from +format|buffer hook when no formatter is
defined for the current mode #893
+ Change +format|buffer to alias for +format/buffer.
+ A formatter can now be specified explicitly buffer-locally by setting
+format-with to a symbol representing the name of the
formatter (accepts any key of format-all-format-table)
+ Passing C-u to any of +format/buffer, +format/region or
+format/region-or-buffer will now prompt you to select a formatter.
+ Revise docstring for +format-on-save-enabled-modes
This is much too unpredictable, considering the variable nature of elisp
indentation, and the possibility that certain functions and their indent
behavior may not be defined/declared when the file is being formatted.
Also renames +format|on-save to +format|buffer for clarity. It should
not (normally) be used directly. Use `+format|enable-on-save-maybe` and
`+format|enable-on-save`.
Centralized code formatting with built-in support for a variety of
languages. Provides the set-formatter! function for defining your own.
Still experimental and needs more testing!