summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2017-10-09 11:12:57 +0100
committerJoão Távora <joaotavora@gmail.com>2017-10-09 11:12:57 +0100
commit11b37b4a9f3a032f307ff644ed76b31c3133f718 (patch)
treeee6512e8668ab0455d2c47da68432530a7464e93 /test/lisp/progmodes
parent36ed9a9ede7057dbd30492ae88aab3b5b8c8f23a (diff)
downloademacs-11b37b4a9f3a032f307ff644ed76b31c3133f718.tar.gz
Be lazy when starting Flymake checks
Don't start the check immediately if the buffer is not being displayed. Wait until it is, using window-configuration-change-hook. This enables the user to batch-enable flymake-mode on many buffers and not have that operation exhaust system resources for checking each one. Likewise, an editing or save operation in a currently non-displayed buffer does not immediately start a check. * lisp/progmodes/flymake.el (flymake-start-on-flymake-mode): Rename from flymake-start-syntax-check-on-find-file. (flymake-start-syntax-check-on-find-file): Obsolete alias for flymake-start-on-flymake-mode. (flymake-start): Redesign. Affect the global post-command-hook and local window-configuraiton-change-hook. (flymake--schedule-timer-maybe) (flymake-after-change-function, flymake-after-save-hook): Pass t to flymake-start. * test/lisp/progmodes/flymake-tests.el (flymake-tests--call-with-fixture) (dummy-backends, recurrent-backend): Start flymake check explicitly and immediately.
Diffstat (limited to 'test/lisp/progmodes')
-rw-r--r--test/lisp/progmodes/flymake-tests.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el
index 5e042f2b082..0b29b6a9715 100644
--- a/test/lisp/progmodes/flymake-tests.el
+++ b/test/lisp/progmodes/flymake-tests.el
@@ -73,7 +73,9 @@ SEVERITY-PREDICATE is used to setup
(when sev-pred-supplied-p
(setq-local flymake-proc-diagnostic-type-pred severity-predicate))
(goto-char (point-min))
- (unless flymake-mode (flymake-mode 1))
+ (let ((flymake-start-on-flymake-mode nil))
+ (unless flymake-mode (flymake-mode 1)))
+ (flymake-start)
(flymake-tests--wait-for-backends)
(funcall fn)))
(and buffer
@@ -230,7 +232,9 @@ SEVERITY-PREDICATE is used to setup
'crashing-backend
))
(flymake-wrap-around nil))
- (flymake-mode)
+ (let ((flymake-start-on-flymake-mode nil))
+ (flymake-mode))
+ (flymake-start)
(flymake-tests--assert-set (flymake-running-backends)
(error-backend warning-backend panicking-backend)
@@ -299,7 +303,9 @@ SEVERITY-PREDICATE is used to setup
(let ((flymake-diagnostic-functions
(list 'eager-backend))
(flymake-wrap-around nil))
- (flymake-mode)
+ (let ((flymake-start-on-flymake-mode nil))
+ (flymake-mode))
+ (flymake-start)
(flymake-tests--assert-set (flymake-running-backends)
(eager-backend) ())
(cl-loop until tick repeat 4 do (sleep-for 0.2))