Ignore narrowed buffers (#127)

Fixes #124

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
This commit is contained in:
Ellis Kenyő 2022-09-11 01:06:06 +01:00 committed by GitHub
parent 4555ace65b
commit 8ff45766fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -17,6 +17,10 @@ The format is based on [Keep a Changelog].
(e.g. scalafmt), do not erase the buffer ([#116]). (e.g. scalafmt), do not erase the buffer ([#116]).
* Fix `Error: "Selecting deleted buffer"` which occurred in some * Fix `Error: "Selecting deleted buffer"` which occurred in some
circumstances due to a race condition ([#123]). circumstances due to a race condition ([#123]).
* Apheleia does not delete the contents of narrowed buffers when
running. Instead, it is disabled in narrowed buffers. Support for
narrowed buffers may be added in future but it has never been
correctly supported in the past (see [#43]). More at [#124], [#127].
### Formatters ### Formatters
* [elm-format](https://github.com/avh4/elm-format) for Elm ([#100]). * [elm-format](https://github.com/avh4/elm-format) for Elm ([#100]).
@ -25,6 +29,7 @@ The format is based on [Keep a Changelog].
* [stylua](https://github.com/JohnnyMorganz/StyLua) for Lua ([#105]). * [stylua](https://github.com/JohnnyMorganz/StyLua) for Lua ([#105]).
* Native Emacs indentation of Emacs Lisp code as a formatter ([#102]). * Native Emacs indentation of Emacs Lisp code as a formatter ([#102]).
[#43]: https://github.com/radian-software/apheleia/issues/43
[#100]: https://github.com/radian-software/apheleia/pull/100 [#100]: https://github.com/radian-software/apheleia/pull/100
[#101]: https://github.com/radian-software/apheleia/pull/101 [#101]: https://github.com/radian-software/apheleia/pull/101
[#102]: https://github.com/radian-software/apheleia/pull/102 [#102]: https://github.com/radian-software/apheleia/pull/102
@ -34,7 +39,9 @@ The format is based on [Keep a Changelog].
[#116]: https://github.com/radian-software/apheleia/pull/116 [#116]: https://github.com/radian-software/apheleia/pull/116
[#119]: https://github.com/radian-software/apheleia/pull/119 [#119]: https://github.com/radian-software/apheleia/pull/119
[#123]: https://github.com/radian-software/apheleia/issues/123 [#123]: https://github.com/radian-software/apheleia/issues/123
[#124]: https://github.com/radian-software/apheleia/issues/124
[#125]: https://github.com/radian-software/apheleia/pull/125 [#125]: https://github.com/radian-software/apheleia/pull/125
[#127]: https://github.com/radian-software/apheleia/pull/127
## 3.0 (released 2022-06-01) ## 3.0 (released 2022-06-01)
### Breaking changes ### Breaking changes

View file

@ -1291,7 +1291,7 @@ operating, to prevent an infinite loop.")
(defun apheleia--format-after-save () (defun apheleia--format-after-save ()
"Run code formatter for current buffer if any configured, then save." "Run code formatter for current buffer if any configured, then save."
(unless apheleia--format-after-save-in-progress (unless apheleia--format-after-save-in-progress
(when apheleia-mode (when (and apheleia-mode (not (buffer-narrowed-p)))
(when-let ((formatters (apheleia--get-formatters))) (when-let ((formatters (apheleia--get-formatters)))
(apheleia-format-buffer (apheleia-format-buffer
formatters formatters