diff options
| author | Chris Chen <chrischen@ignity.xyz> | 2026-04-22 10:53:05 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-22 02:53:05 +0000 |
| commit | 1720200b1271a9e70ebfc86c0f942ff02aefcdd1 (patch) | |
| tree | 2c2832df236cae0089616c0c007a9881010a08a8 /apheleia-formatters.el | |
| parent | 14316996958ec8962d9395bc4d986411f77971de (diff) | |
fix: sync lisp-indent-offset and lisp-body-indent in apheleia-indent-lisp-buffer (#393)
apheleia-indent-lisp-buffer copies several buffer-local variables to the
scratch buffer before running indent-region, but lisp-indent-offset and
lisp-body-indent are missing. When either of these is set in the
original
buffer, the scratch buffer falls back to different defaults, producing
indentation that disagrees with what indent-region would produce
interactively.
Reproducer: with lisp-indent-offset set to 2, the following form
(setopt
lsp-inlay-hint-enable t
lsp-log-io nil)
formats to one space of indentation instead of two.
Fix: sync lisp-indent-offset and lisp-body-indent from the original
buffer
to the scratch buffer, the same way the existing code already does for
indent-line-function, lisp-indent-function, and indent-tabs-mode.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
Diffstat (limited to 'apheleia-formatters.el')
| -rw-r--r-- | apheleia-formatters.el | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/apheleia-formatters.el b/apheleia-formatters.el index bbbbe8e..8c04769 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -1249,6 +1249,10 @@ For more implementation detail, see (buffer-local-value 'lisp-indent-function buffer)) (setq-local indent-tabs-mode (buffer-local-value 'indent-tabs-mode buffer)) + (setq-local lisp-indent-offset + (buffer-local-value 'lisp-indent-offset buffer)) + (setq-local lisp-body-indent + (buffer-local-value 'lisp-body-indent buffer)) (goto-char (point-min)) (let ((inhibit-message t) (message-log-max nil)) |
