保存时显示Flycheck缓冲区(有错误) [英] Display Flycheck buffer (with errors) when saving

查看:108
本文介绍了保存时显示Flycheck缓冲区(有错误)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In Emacs, what would be the way to display the Flycheck buffer automatically when saving, only if there are errors?

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

我已经搜索了 https://stackoverflow.com/questions/tagged/flycheck? sort = votes& pageSize = 50 ,但没有发现任何内容.

I've searched on https://stackoverflow.com/questions/tagged/flycheck?sort=votes&pageSize=50 but did not find anything approaching.

推荐答案

将以下内容添加到~/.emacs,这会将其绑定到C-x C-s:

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)

这篇关于保存时显示Flycheck缓冲区(有错误)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆