有没有办法让flymake只在保存时才编译

发布于 2024-11-09 13:26:10 字数 127 浏览 0 评论 0原文

当我输入 Flymake 时,光标会稍微悬起。这有点烦人。

我想知道是否有一种方法可以告诉 Flymake 在每次更改某些内容时不要解析和编译,只需在保存时执行即可。

还有其他建议吗?

谢谢,

When I type flymake makes the cursor hang a little. It's kind of annoying.

I was wondering if there is a way to tell flymake to do not parse and compile each time I change something, just do it when I save.

Any other suggestion?

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甩你一脸翔 2024-11-16 13:26:10

您可以通过将其放入 .emacsinit.el 文件中来覆盖 Flymake.el 中的 flymake-after-change-function

(eval-after-load "flymake"
  '(progn
    (defun flymake-after-change-function (start stop len)
      "Start syntax check for current buffer if it isn't already running."
      ;; Do nothing, don't want to run checks until I save.
      )))

:当您保存和最初加载文件时,仍然会进行语法检查,如果您不喜欢加载文件时的初始语法检查,您应该能够(我没有测试过这部分)将其关闭:

(setq flymake-start-syntax-check-on-find-file nil)

编辑:与您的问题没有直接关系,但如果只是滞后问题可能会有所帮助,您可以调整保存开始之前应该空闲的时间in with:

;; Only run flymake if I've not been typing for 5 seconds
(setq flymake-no-changes-timeout 5)

默认值为 0.5 秒,因此也许像我一样将其更改为 5 可能比简单地完全关闭它更有帮助。

You can override the flymake-after-change-function from flymake.el by putting this in your .emacs or init.el file:

(eval-after-load "flymake"
  '(progn
    (defun flymake-after-change-function (start stop len)
      "Start syntax check for current buffer if it isn't already running."
      ;; Do nothing, don't want to run checks until I save.
      )))

You will still get a syntax check when you save and when you initially load a file, if you don't like the initial syntax check on loading the file, you should be be able (I haven't tested this part) to turn it off with:

(setq flymake-start-syntax-check-on-find-file nil)

Edit: not directly related to your question, but might be helpful if just the lag is an issue, you can tailor how long you should be idle before the save kicks in with:

;; Only run flymake if I've not been typing for 5 seconds
(setq flymake-no-changes-timeout 5)

The default is 0.5 seconds, so perhaps changing it to 5 like me might help you more than simply turning it off entirely.

美煞众生 2024-11-16 13:26:10

您可以将 flymake-no-changes-timeout 设置为 nil(而不是默认的 0.5)以禁用更改检查。这是 flymake 组中的自定义设置。您需要使用值菜单来选择1(不检查超时)。

默认情况下,启用其他启动设置:flymake-start-on-save-bufferflymake-start-on-flymake-mode。这些对我来说就足够了,并且是首选,因为不断节省零钱可能会变得非常烦人。

自定义

You can set flymake-no-changes-timeout to nil (instead of default 0.5) to disable the on-change check. This is a customize setting in the flymake group. You'll need to use the value menu to choose 1 (no check on timeout).

By default, the other start-on settings are enabled: flymake-start-on-save-buffer, flymake-start-on-flymake-mode. Those suffice for me, and are preferred since constant saving-on-change can get pretty annoying.

customize

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文