From 3b54ddb32db77ba297d0f1586a41aa1753713e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ellis=20Keny=C5=91?= Date: Thu, 8 Sep 2022 06:47:35 +0100 Subject: [PATCH 1/2] fix: ignore narrowed buffers Fixes #124 --- apheleia.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apheleia.el b/apheleia.el index df89471d..e438e69a 100644 --- a/apheleia.el +++ b/apheleia.el @@ -1285,7 +1285,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 From 03d975fd9c331212a9b87a66640317f4858fdfd6 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sat, 10 Sep 2022 16:57:49 -0700 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d87b17ee..9c8fe6a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ The format is based on [Keep a Changelog]. ### Bugs fixed * When a formatter has a bug and fails to return anything on stdout (e.g. scalafmt), do not erase the buffer ([#116]). +* 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]). @@ -23,6 +27,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 @@ -31,6 +36,8 @@ The format is based on [Keep a Changelog]. [#110]: https://github.com/radian-software/apheleia/pull/110 [#116]: https://github.com/radian-software/apheleia/pull/116 [#119]: https://github.com/radian-software/apheleia/pull/119 +[#124]: https://github.com/radian-software/apheleia/issues/124 +[#127]: https://github.com/radian-software/apheleia/pull/127 ## 3.0 (released 2022-06-01) ### Breaking changes