diff options
| author | João Távora | 2017-10-09 11:12:57 +0100 |
|---|---|---|
| committer | João Távora | 2017-10-09 11:12:57 +0100 |
| commit | 11b37b4a9f3a032f307ff644ed76b31c3133f718 (patch) | |
| tree | ee6512e8668ab0455d2c47da68432530a7464e93 /test | |
| parent | 36ed9a9ede7057dbd30492ae88aab3b5b8c8f23a (diff) | |
| download | emacs-11b37b4a9f3a032f307ff644ed76b31c3133f718.tar.gz emacs-11b37b4a9f3a032f307ff644ed76b31c3133f718.zip | |
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')
| -rw-r--r-- | test/lisp/progmodes/flymake-tests.el | 12 |
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 | |||
| 73 | (when sev-pred-supplied-p | 73 | (when sev-pred-supplied-p |
| 74 | (setq-local flymake-proc-diagnostic-type-pred severity-predicate)) | 74 | (setq-local flymake-proc-diagnostic-type-pred severity-predicate)) |
| 75 | (goto-char (point-min)) | 75 | (goto-char (point-min)) |
| 76 | (unless flymake-mode (flymake-mode 1)) | 76 | (let ((flymake-start-on-flymake-mode nil)) |
| 77 | (unless flymake-mode (flymake-mode 1))) | ||
| 78 | (flymake-start) | ||
| 77 | (flymake-tests--wait-for-backends) | 79 | (flymake-tests--wait-for-backends) |
| 78 | (funcall fn))) | 80 | (funcall fn))) |
| 79 | (and buffer | 81 | (and buffer |
| @@ -230,7 +232,9 @@ SEVERITY-PREDICATE is used to setup | |||
| 230 | 'crashing-backend | 232 | 'crashing-backend |
| 231 | )) | 233 | )) |
| 232 | (flymake-wrap-around nil)) | 234 | (flymake-wrap-around nil)) |
| 233 | (flymake-mode) | 235 | (let ((flymake-start-on-flymake-mode nil)) |
| 236 | (flymake-mode)) | ||
| 237 | (flymake-start) | ||
| 234 | 238 | ||
| 235 | (flymake-tests--assert-set (flymake-running-backends) | 239 | (flymake-tests--assert-set (flymake-running-backends) |
| 236 | (error-backend warning-backend panicking-backend) | 240 | (error-backend warning-backend panicking-backend) |
| @@ -299,7 +303,9 @@ SEVERITY-PREDICATE is used to setup | |||
| 299 | (let ((flymake-diagnostic-functions | 303 | (let ((flymake-diagnostic-functions |
| 300 | (list 'eager-backend)) | 304 | (list 'eager-backend)) |
| 301 | (flymake-wrap-around nil)) | 305 | (flymake-wrap-around nil)) |
| 302 | (flymake-mode) | 306 | (let ((flymake-start-on-flymake-mode nil)) |
| 307 | (flymake-mode)) | ||
| 308 | (flymake-start) | ||
| 303 | (flymake-tests--assert-set (flymake-running-backends) | 309 | (flymake-tests--assert-set (flymake-running-backends) |
| 304 | (eager-backend) ()) | 310 | (eager-backend) ()) |
| 305 | (cl-loop until tick repeat 4 do (sleep-for 0.2)) | 311 | (cl-loop until tick repeat 4 do (sleep-for 0.2)) |