Is there a way to make flymake to compile only when I save

ε祈祈猫儿з 提交于 2019-12-10 21:13:55

问题


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,


回答1:


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.



来源:https://stackoverflow.com/questions/6110691/is-there-a-way-to-make-flymake-to-compile-only-when-i-save

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