保存时显示Flycheck缓冲区(有错误)
问题描述:
在Emacs中,只有在存在错误时才会在保存时自动显示Flycheck缓冲区?保存时显示Flycheck缓冲区(有错误)
有点像https://github.com/steelbrain/linter。
我在https://*.com/questions/tagged/flycheck?sort=votes&pageSize=50上搜索,但没有发现任何接近。
答
添加以下~/.emacs
,这将其绑定到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)