aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2017-09-29 12:18:30 +0100
committerJoão Távora2017-10-03 14:18:55 +0100
commit91851c3ea05392701ca779961e4fb518635fa5b2 (patch)
treeb52f70b65bb6fd1063ec41d28d57d5d4b72ad1a1
parentbd8ea8873d19e6885e7d6c18c112ed0020d4f744 (diff)
downloademacs-91851c3ea05392701ca779961e4fb518635fa5b2.tar.gz
emacs-91851c3ea05392701ca779961e4fb518635fa5b2.zip
Flymake variable flymake-diagnostic-functions now a special hook
* lisp/progmodes/flymake-proc.el: Use add-hook to affect flymake-diagnostic-functions. * lisp/progmodes/flymake-elisp.el (flymake-elisp-setup-backends): Use add-hook. * lisp/progmodes/flymake.el (flymake-diagnostic-functions): Revise docstring. (flymake-start): Use run-hook-wrapped.
-rw-r--r--lisp/progmodes/flymake-elisp.el6
-rw-r--r--lisp/progmodes/flymake-proc.el3
-rw-r--r--lisp/progmodes/flymake.el69
3 files changed, 39 insertions, 39 deletions
diff --git a/lisp/progmodes/flymake-elisp.el b/lisp/progmodes/flymake-elisp.el
index 6e7fe3142d3..7797d278e3f 100644
--- a/lisp/progmodes/flymake-elisp.el
+++ b/lisp/progmodes/flymake-elisp.el
@@ -159,10 +159,8 @@ Runs in a batch-mode Emacs. Interactively use variable
159 159
160(defun flymake-elisp-setup-backends () 160(defun flymake-elisp-setup-backends ()
161 "Setup flymake for elisp work." 161 "Setup flymake for elisp work."
162 (add-to-list (make-local-variable 'flymake-diagnostic-functions) 162 (add-hook 'flymake-diagnostic-functions 'flymake-elisp-checkdoc t t)
163 'flymake-elisp-checkdoc t) 163 (add-hook 'flymake-diagnostic-functions 'flymake-elisp-byte-compile t t))
164 (add-to-list (make-local-variable 'flymake-diagnostic-functions)
165 'flymake-elisp-byte-compile t))
166 164
167(add-hook 'emacs-lisp-mode-hook 165(add-hook 'emacs-lisp-mode-hook
168 'flymake-elisp-setup-backends) 166 'flymake-elisp-setup-backends)
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 966f358551f..3ab5523128f 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -1114,8 +1114,7 @@ Use CREATE-TEMP-F for creating temp copy."
1114 1114
1115 1115
1116;;;; Hook onto flymake-ui 1116;;;; Hook onto flymake-ui
1117(add-to-list 'flymake-diagnostic-functions 1117(add-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake)
1118 'flymake-proc-legacy-flymake)
1119 1118
1120 1119
1121;;;; 1120;;;;
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 3387f47ed1e..88a305aa545 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -309,36 +309,36 @@ Return nil if the region is invalid."
309 (error (flymake-error "Invalid region line=%s col=%s" line col)))) 309 (error (flymake-error "Invalid region line=%s col=%s" line col))))
310 310
311(defvar flymake-diagnostic-functions nil 311(defvar flymake-diagnostic-functions nil
312 "List of flymake backends i.e. sources of flymake diagnostics. 312 "Special hook of Flymake backends to check a buffer.
313 313
314This variable holds an arbitrary number of \"backends\" or 314The functions in this hook diagnose problems in a buffer’s
315\"checkers\" providing the flymake user interface with 315contents and provide the Flymake user interface with information
316information about where and how to annotate problems diagnosed in 316about where and how to annotate problems diagnosed in a buffer.
317a buffer.
318 317
319Backends are lisp functions sharing a common calling 318Whenever Flymake or the user decides to re-check the buffer, each
320convention. Whenever flymake decides it is time to re-check the 319function is called with a common calling convention, a single
321buffer, each backend is called with a single argument, a 320REPORT-FN argument, detailed below. Backend functions are first
322REPORT-FN callback, detailed below. Backend functions are first
323expected to quickly and inexpensively announce the feasibility of 321expected to quickly and inexpensively announce the feasibility of
324checking the buffer (i.e. they aren't expected to immediately 322checking the buffer via the return value (i.e. they aren't
325start checking the buffer): 323required to immediately start checking the buffer):
326 324
327* If the backend function returns nil, flymake forgets about this 325* If the backend function returns nil, Flymake forgets about this
328 backend for the current check, but will call it again the next 326 backend for the current check, but will call it again for the
329 time; 327 next one;
330 328
331* If the backend function returns non-nil, flymake expects this 329* If the backend function returns non-nil, Flymake expects this
332 backend to check the buffer and call its REPORT-FN callback 330 backend to check the buffer and call its REPORT-FN callback
333 function exactly once. If the computation involved is 331 function exactly once. If the computation involved is
334 inexpensive, the backend function may do so synchronously 332 inexpensive, the backend function may do so synchronously,
335 before returning. If it is not, it may do so after returning, 333 before returning. If it is not, it should do so after
336 using idle timers, asynchronous processes or other asynchronous 334 returning, using idle timers, asynchronous processes or other
337 mechanisms. 335 asynchronous mechanisms.
338 336
339* If the backend function signals an error, it is disabled, 337* If the backend function signals an error, it is disabled,
340 i.e. flymake will not attempt it again for this buffer until 338 i.e. Flymake will not use it again for the current or any
341 `flymake-mode' is turned off and on again. 339 future checks of this buffer. Certain commands, like turning
340 `flymake-mode' on and off again, resets the list of disabled
341 backends.
342 342
343Backends are required to call REPORT-FN with a single argument 343Backends are required to call REPORT-FN with a single argument
344ACTION followed by an optional list of keywords parameters and 344ACTION followed by an optional list of keywords parameters and
@@ -347,7 +347,7 @@ their values (:KEY1 VALUE1 :KEY2 VALUE2...).
347The possible values for ACTION are. 347The possible values for ACTION are.
348 348
349* A (possibly empty) list of objects created with 349* A (possibly empty) list of objects created with
350 `flymake-make-diagnostic', causing flymake to annotate the 350 `flymake-make-diagnostic', causing Flymake to annotate the
351 buffer with this information and consider the backend has 351 buffer with this information and consider the backend has
352 having finished its check normally. 352 having finished its check normally.
353 353
@@ -362,7 +362,7 @@ The recognized optional keyword arguments are:
362* ‘:explanation’: value should give user-readable details of 362* ‘:explanation’: value should give user-readable details of
363 the situation encountered, if any. 363 the situation encountered, if any.
364 364
365* ‘:force’: value should be a boolean forcing the flymake UI 365* ‘:force’: value should be a boolean forcing the Flymake UI
366 to consider the report even if was somehow unexpected.") 366 to consider the report even if was somehow unexpected.")
367 367
368(defvar flymake-diagnostic-types-alist 368(defvar flymake-diagnostic-types-alist
@@ -613,15 +613,18 @@ backends."
613 (setq flymake--diagnostics-table (make-hash-table) 613 (setq flymake--diagnostics-table (make-hash-table)
614 flymake--running-backends nil 614 flymake--running-backends nil
615 flymake--disabled-backends nil)) 615 flymake--disabled-backends nil))
616 (dolist (backend flymake-diagnostic-functions) 616 (run-hook-wrapped
617 (cond ((memq backend flymake--running-backends) 617 'flymake-diagnostic-functions
618 (flymake-log :debug "Backend %s still running, not restarting" 618 (lambda (backend)
619 backend)) 619 (cond ((memq backend flymake--running-backends)
620 ((memq backend flymake--disabled-backends) 620 (flymake-log :debug "Backend %s still running, not restarting"
621 (flymake-log :debug "Backend %s is disabled, not starting" 621 backend))
622 backend)) 622 ((memq backend flymake--disabled-backends)
623 (t 623 (flymake-log :debug "Backend %s is disabled, not starting"
624 (flymake--run-backend backend)))))) 624 backend))
625 (t
626 (flymake--run-backend backend)))
627 nil))))
625 (if (and deferred 628 (if (and deferred
626 this-command) 629 this-command)
627 (add-hook 'post-command-hook #'start 'append 'local) 630 (add-hook 'post-command-hook #'start 'append 'local)