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

2

6

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,

Bottom answered 24/5, 2011 at 12:50 Comment(0)
J
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.

Jordan answered 2/8, 2011 at 22:57 Comment(0)
F
0

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

Flaherty answered 24/5 at 21:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.