+format|buffer: use pcase-let & return boolean
So it can be used in other functions.
This commit is contained in:
parent
75b39a9396
commit
81ee563c4c
1 changed files with 4 additions and 5 deletions
|
@ -197,9 +197,8 @@ is selected)."
|
||||||
"Format the source code in the current buffer with minimal feedback.
|
"Format the source code in the current buffer with minimal feedback.
|
||||||
|
|
||||||
Meant for `before-save-hook'."
|
Meant for `before-save-hook'."
|
||||||
(cl-destructuring-bind (formatter mode-result) (format-all-probe)
|
(pcase-let ((`(,formatter ,mode-result) (format-all-probe)))
|
||||||
(pcase (+format-buffer formatter mode-result)
|
(pcase (+format-buffer formatter mode-result)
|
||||||
(`error (message "Failed to format buffer due to errors"))
|
(`error (message "Failed to format buffer due to errors") nil)
|
||||||
(`noop (message "Buffer was already formatted"))
|
(`noop (message "Buffer was already formatted") nil)
|
||||||
(_ (message "Formatted (%s)" formatter)))))
|
(_ (message "Formatted (%s)" formatter) t))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue