aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Chen <chrischen@ignity.xyz>2026-04-22 10:53:05 +0800
committerGitHub <noreply@github.com>2026-04-22 02:53:05 +0000
commit1720200b1271a9e70ebfc86c0f942ff02aefcdd1 (patch)
tree2c2832df236cae0089616c0c007a9881010a08a8
parent14316996958ec8962d9395bc4d986411f77971de (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>
-rw-r--r--CHANGELOG.md3
-rw-r--r--apheleia-formatters.el4
2 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5409a58..b48b92c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,11 +36,14 @@ The format is based on [Keep a Changelog].
### Bugs fixed
* `shfmt` did not work with `apheleia-formatters-respect-indent-level`
* `apheleia-npx` did return an error when formatter was missing
+* `lisp-indent` formatter did not respect `lisp-indent-offset` and
+ `lisp-body-offset` ([#393])
[#378]: https://github.com/radian-software/apheleia/pull/378
[#380]: https://github.com/radian-software/apheleia/pull/380
[#382]: https://github.com/radian-software/apheleia/pull/382
[#386]: https://github.com/radian-software/apheleia/pull/386
+[#393]: https://github.com/radian-software/apheleia/pull/393
## 4.4.2 (released 2025-11-21)
### Bugs fixed
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))