Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore narrowed buffers #127

Merged
merged 3 commits into from
Sep 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ The format is based on [Keep a Changelog].
(e.g. scalafmt), do not erase the buffer ([#116]).
* Fix `Error: "Selecting deleted buffer"` which occurred in some
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
* [elm-format](https://github.com/avh4/elm-format) for Elm ([#100]).
Expand All @@ -25,6 +29,7 @@ The format is based on [Keep a Changelog].
* [stylua](https://github.com/JohnnyMorganz/StyLua) for Lua ([#105]).
* 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
[#101]: https://github.com/radian-software/apheleia/pull/101
[#102]: https://github.com/radian-software/apheleia/pull/102
Expand All @@ -34,7 +39,9 @@ The format is based on [Keep a Changelog].
[#116]: https://github.com/radian-software/apheleia/pull/116
[#119]: https://github.com/radian-software/apheleia/pull/119
[#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
[#127]: https://github.com/radian-software/apheleia/pull/127

## 3.0 (released 2022-06-01)
### Breaking changes
Expand Down
2 changes: 1 addition & 1 deletion apheleia.el
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ operating, to prevent an infinite loop.")
(defun apheleia--format-after-save ()
"Run code formatter for current buffer if any configured, then save."
(unless apheleia--format-after-save-in-progress
(when apheleia-mode
(when (and apheleia-mode (not (buffer-narrowed-p)))
(when-let ((formatters (apheleia--get-formatters)))
(apheleia-format-buffer
formatters
Expand Down