From 1720200b1271a9e70ebfc86c0f942ff02aefcdd1 Mon Sep 17 00:00:00 2001 From: Chris Chen Date: Wed, 22 Apr 2026 10:53:05 +0800 Subject: 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 --- CHANGELOG.md | 3 +++ apheleia-formatters.el | 4 ++++ 2 files changed, 7 insertions(+) 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)) -- cgit v1.0