问题
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