BREAKING CHANGE: This deprecates the IS-(MAC|WINDOWS|LINUX|BSD) family
of global constants in favor of a native `featurep` check:
IS-MAC -> (featurep :system 'macos)
IS-WINDOWS -> (featurep :system 'windows)
IS-LINUX -> (featurep :system 'linux)
IS-BSD -> (featurep :system 'bsd)
The constants will stick around until the v3 release so folks can still
use it -- and there are still some modules that use it, but I'll phase
those uses out gradually.
Fix: #7479
This happened because LSP hooks on kill-buffer-hook (and possibly
others) caused our temporary formatting buffer to talk to LSP as if it
were the original buffer. When the temp buffer was cleaned up, LSP
assumed the original buffer had been closed. No more!
In fact, to avoid similar issues, let's avoid any complex functionality
in hooks in this temp buffer.
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
Src blocks can now be reformatted. `+format/buffer` will reformat the
whole src block at point. `+format/region` will format only the
selection (even a subset of a src block).
Closes#3484
Currently the user has to select `SPC c F` for lsp format. But if
lsp-mode is enabled, the user will always want to use the LSP formatter.
So this changes the default `SPC c f` to use lsp formatter if available.
This simplifies the interface a bit so the user doesn't have to worry
about selecting the "right" format, just like how other commands get
auto bound to LSP functions.
Make +format-buffer copy all buffer-local variables from the original buffer into the temporary buffer. When resolving a symbol inside of a formatter, the value it is bound to in the formatted buffer will now be used instead of the default value. Fixes#2036.
Currently `+format-completing-read` returns a cons cell like `(symbol . t)`, where `+format/buffer` expects a symbol. This commit makes `+format-completing-read` return a symbol instead. Fixes#2349.
The fix for #1489 (in 13f5a762) gives the temp buffer (where formatting
is performed) a real buffer-file-name, which causes it to prompt to save
it when it is killed.
+ 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.
In case we need a conditional to test against in our formatters. e.g. in
go-mode, goimports is incompatible with partial formatting, so we force
it to use gofmt in that case.
+ 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