aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadon Rosborough <radon.neon@gmail.com>2022-01-02 16:41:20 -0800
committerRadon Rosborough <radon.neon@gmail.com>2022-01-02 16:41:20 -0800
commitd3304b018c4586fbdd49d5277740c50f905beae4 (patch)
tree8b1c20eb0078df9d4b6620dac69ec89d245d3b9a
parent6449a7439eb7fa1b5192e7a6d7ca329e9e998edd (diff)
Fix rustfmt, show log by default
-rw-r--r--CHANGELOG.md12
-rw-r--r--apheleia.el23
2 files changed, 30 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 193a2bd..8645dec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,14 @@ The format is based on [Keep a Changelog].
function as a formatter allowing you to plug more powerful
formatters into apheleia such as language servers.
+## Changes
+* Stdout and stderr buffers are no longer retained after running a
+ formatter. Instead, the stderr is appended into an
+ `*apheleia-whatever-log*` buffer if it fails, or unconditionally if
+ the new user option `apheleia-verbose` is set to non-nil. See [#64],
+ [#65]. The log buffer is not hidden by default, and this can be
+ changed via the new user option `apheleia-hide-log-buffer` ([#69]).
+
## Bugs fixed
* Allow running the same formatter in multiple buffers in parallel
([#64], [#65]). Previously, when saving a number of files at the
@@ -18,12 +26,16 @@ The format is based on [Keep a Changelog].
* In some circumstances the error `wrong-type-argument bufferp nil`
could be reported when running certain formatters under Apheleia.
This has been fixed.
+* Rustfmt is no longer passed the `--unstable-features` and
+ `--skip-children` flags, since they are not available on all
+ versions of Rustfmt ([#69]).
[#52]: https://github.com/raxod502/apheleia/issues/52
[#60]: https://github.com/raxod502/apheleia/issues/60
[#62]: https://github.com/raxod502/apheleia/issues/62
[#64]: https://github.com/raxod502/apheleia/issues/64
[#65]: https://github.com/raxod502/apheleia/pull/65
+[#69]: https://github.com/raxod502/apheleia/issues/69
## 1.2 (released 2021-12-27)
### Enhancements
diff --git a/apheleia.el b/apheleia.el
index 7f2ffe3..96a09cd 100644
--- a/apheleia.el
+++ b/apheleia.el
@@ -36,6 +36,13 @@
:link '(url-link :tag "GitHub" "https://github.com/raxod502/apheleia")
:link '(emacs-commentary-link :tag "Commentary" "apheleia"))
+(defcustom apheleia-hide-log-buffer nil
+ "Non-nil means log buffers will be hidden.
+Hidden buffers have names that begin with a space, and do not
+appear in `switch-to-buffer' unless you type in a space
+manually."
+ :type 'boolean)
+
(cl-defun apheleia--edit-distance-table (s1 s2)
"Align strings S1 and S2 for minimum edit distance.
Return the dynamic programming table as has table which maps cons
@@ -283,7 +290,11 @@ command succeeds provided that its exit status is 0."
(stderr (generate-new-buffer
(format " *apheleia-%s-stderr*" name)))
(log (get-buffer-create
- (format " *apheleia-%s-log*" name))))
+ (format "%s*apheleia-%s-log*"
+ (if apheleia-hide-log-buffer
+ " "
+ "")
+ name))))
(condition-case-unless-debug e
(progn
(setq apheleia--current-process
@@ -320,10 +331,13 @@ command succeeds provided that its exit status is 0."
(message
(concat
"Failed to run %s: exit status %s "
- "(see hidden buffer%s)")
+ "(see %s %s)")
(car command)
(process-exit-status proc)
- log))
+ (if (string-prefix-p " " (buffer-name log))
+ "hidden buffer"
+ "buffer")
+ (string-trim (buffer-name log))))
(when ensure
(funcall ensure))
(kill-buffer stdout)
@@ -626,8 +640,7 @@ function: %s" command)))
(latexindent . ("latexindent"))
(ocamlformat . ("ocamlformat" "-" "--name" filepath))
(prettier . (npx "prettier" "--stdin-filepath" filepath))
- (rustfmt . ("rustfmt" "--unstable-features" "--skip-children"
- "--quiet" "--emit" "stdout"))
+ (rustfmt . ("rustfmt" "--quiet" "--emit" "stdout"))
(terraform . ("terraform" "fmt" "-")))
"Alist of code formatting commands.
The keys may be any symbols you want, and the values are