diff options
| author | tpeacock19 <git@treypeacock.com> | 2024-03-02 14:27:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-02 13:27:24 -0800 |
| commit | 2fec5692e424cd24e7450d63bbe58f75eafb7417 (patch) | |
| tree | b4e1fe76322f001a275cfd13c8e866847d26ae98 | |
| parent | 7ba74c7cc28e4f0da4006968ecb8587133daa142 (diff) | |
Update `apheleia-indent-lisp-buffer` to respect local variables (#286)
I ran into some issues using apheleia while contributing to a project
that works with `indent-tabs-mode` disabled. This led to this slight
modification of `apheleia-indent-lisp-buffer`
This allows for any local values for `indent-line-function`,
`lisp-indent-function` to be carried over when
formatting. Additionally, added `indent-tabs-mode` in order to
prevent adding tabs when unwanted.
| -rw-r--r-- | CHANGELOG.md | 9 | ||||
| -rw-r--r-- | apheleia-formatters.el | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index af248c0..d64ec42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog]. +## Unreleased +### Enhancements +### Formatters +### Bugs fixed +* `apheleia-indent-lisp-buffer` updated to apply local variables after + calling major-mode. Also includes setting for `indent-tabs-mode` ([#286]). + +[#286]: https://github.com/radian-software/apheleia/pull/286 + ## 4.1 (released 2024-02-25) ### Enhancements * Use `perltidy` as default formatter for `cperl-mode` ([#260]). diff --git a/apheleia-formatters.el b/apheleia-formatters.el index 4de755c..21976e7 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -1095,11 +1095,13 @@ transformation. For more implementation detail, see `apheleia--run-formatter-function'." (with-current-buffer scratch + (funcall (with-current-buffer buffer major-mode)) (setq-local indent-line-function (buffer-local-value 'indent-line-function buffer)) (setq-local lisp-indent-function - (buffer-local-value 'lisp-indent-function buffer)) - (funcall (with-current-buffer buffer major-mode)) + (buffer-local-value 'lisp-indent-function buffer)) + (setq-local indent-tabs-mode + (buffer-local-value 'indent-tabs-mode buffer)) (goto-char (point-min)) (let ((inhibit-message t) (message-log-max nil)) |
