问题
In Emacs, what would be the way to display the Flycheck buffer automatically when saving, only if there are errors?
A bit like https://github.com/steelbrain/linter.
I've searched on https://stackoverflow.com/questions/tagged/flycheck?sort=votes&pageSize=50 but did not find anything approaching.
回答1:
Add the following to ~/.emacs
, this will bind it to C-x C-s
:
(defun save-buffer-maybe-show-errors ()
"Save buffer and show errors if any."
(interactive)
(save-buffer)
(when (not flycheck-current-errors)
(flycheck-list-errors)))
;; Bind it to some key:
(global-set-key (kbd "C-x C-s") 'save-buffer-maybe-show-errors)
来源:https://stackoverflow.com/questions/45536066/display-flycheck-buffer-with-errors-when-saving