Display Flycheck buffer (with errors) when saving

雨燕双飞 提交于 2019-12-12 18:12:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!