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 /apheleia-formatters.el | |
| 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.
Diffstat (limited to 'apheleia-formatters.el')
| -rw-r--r-- | apheleia-formatters.el | 6 |
1 files changed, 4 insertions, 2 deletions
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)) |
