保存时显示Flycheck缓冲区(有错误)

时间:2017-08-06 19:58:01

标签: emacs lint flycheck linter

在Emacs中,只有在出现错误时,保存时自动显示Flycheck缓冲区的方法是什么?

有点像https://github.com/steelbrain/linter

我在https://stackoverflow.com/questions/tagged/flycheck?sort=votes&pageSize=50上搜索过但没有找到任何接近的内容。

1 个答案:

答案 0 :(得分:1)

将以下内容添加到~/.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)