[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 fbc6359 31/3
From: |
João Távora |
Subject: |
[Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 fbc6359 31/39: Flymake variable flymake-diagnostic-functions now a special hook |
Date: |
Mon, 2 Oct 2017 20:12:26 -0400 (EDT) |
branch: scratch/flymake-refactor-cleaner-for-emacs-26
commit fbc6359327a1495509f9d83f057b729dceb4744d
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
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.
---
lisp/progmodes/flymake-elisp.el | 6 ++--
lisp/progmodes/flymake-proc.el | 3 +-
lisp/progmodes/flymake.el | 69 +++++++++++++++++++++--------------------
3 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/lisp/progmodes/flymake-elisp.el b/lisp/progmodes/flymake-elisp.el
index 6e7fe31..7797d27 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
(defun flymake-elisp-setup-backends ()
"Setup flymake for elisp work."
- (add-to-list (make-local-variable 'flymake-diagnostic-functions)
- 'flymake-elisp-checkdoc t)
- (add-to-list (make-local-variable 'flymake-diagnostic-functions)
- 'flymake-elisp-byte-compile t))
+ (add-hook 'flymake-diagnostic-functions 'flymake-elisp-checkdoc t t)
+ (add-hook 'flymake-diagnostic-functions 'flymake-elisp-byte-compile t t))
(add-hook 'emacs-lisp-mode-hook
'flymake-elisp-setup-backends)
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 1f4462a..21eda13 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."
;;;; Hook onto flymake-ui
-(add-to-list 'flymake-diagnostic-functions
- 'flymake-proc-legacy-flymake)
+(add-hook 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake)
;;;;
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index cc81a5f..ecd0df9 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -308,36 +308,36 @@ Return nil if the region is invalid."
(error (flymake-error "Invalid region line=%s col=%s" line col))))
(defvar flymake-diagnostic-functions nil
- "List of flymake backends i.e. sources of flymake diagnostics.
+ "Special hook of Flymake backends to check a buffer.
-This variable holds an arbitrary number of \"backends\" or
-\"checkers\" providing the flymake user interface with
-information about where and how to annotate problems diagnosed in
-a buffer.
+The functions in this hook diagnose problems in a buffer’s
+contents and provide the Flymake user interface with information
+about where and how to annotate problems diagnosed in a buffer.
-Backends are lisp functions sharing a common calling
-convention. Whenever flymake decides it is time to re-check the
-buffer, each backend is called with a single argument, a
-REPORT-FN callback, detailed below. Backend functions are first
+Whenever Flymake or the user decides to re-check the buffer, each
+function is called with a common calling convention, a single
+REPORT-FN argument, detailed below. Backend functions are first
expected to quickly and inexpensively announce the feasibility of
-checking the buffer (i.e. they aren't expected to immediately
-start checking the buffer):
+checking the buffer via the return value (i.e. they aren't
+required to immediately start checking the buffer):
-* If the backend function returns nil, flymake forgets about this
- backend for the current check, but will call it again the next
- time;
+* If the backend function returns nil, Flymake forgets about this
+ backend for the current check, but will call it again for the
+ next one;
-* If the backend function returns non-nil, flymake expects this
+* If the backend function returns non-nil, Flymake expects this
backend to check the buffer and call its REPORT-FN callback
- function exactly once. If the computation involved is
- inexpensive, the backend function may do so synchronously
- before returning. If it is not, it may do so after returning,
- using idle timers, asynchronous processes or other asynchronous
- mechanisms.
+ function exactly once. If the computation involved is
+ inexpensive, the backend function may do so synchronously,
+ before returning. If it is not, it should do so after
+ returning, using idle timers, asynchronous processes or other
+ asynchronous mechanisms.
* If the backend function signals an error, it is disabled,
- i.e. flymake will not attempt it again for this buffer until
- `flymake-mode' is turned off and on again.
+ i.e. Flymake will not use it again for the current or any
+ future checks of this buffer. Certain commands, like turning
+ `flymake-mode' on and off again, resets the list of disabled
+ backends.
Backends are required to call REPORT-FN with a single argument
ACTION followed by an optional list of keywords parameters and
@@ -346,7 +346,7 @@ their values (:KEY1 VALUE1 :KEY2 VALUE2...).
The possible values for ACTION are.
* A (possibly empty) list of objects created with
- `flymake-make-diagnostic', causing flymake to annotate the
+ `flymake-make-diagnostic', causing Flymake to annotate the
buffer with this information and consider the backend has
having finished its check normally.
@@ -361,7 +361,7 @@ The recognized optional keyword arguments are:
* ‘:explanation’: value should give user-readable details of
the situation encountered, if any.
-* ‘:force’: value should be a boolean forcing the flymake UI
+* ‘:force’: value should be a boolean forcing the Flymake UI
to consider the report even if was somehow unexpected.")
(defvar flymake-diagnostic-types-alist
@@ -612,15 +612,18 @@ backends."
(setq flymake--diagnostics-table (make-hash-table)
flymake--running-backends nil
flymake--disabled-backends nil))
- (dolist (backend flymake-diagnostic-functions)
- (cond ((memq backend flymake--running-backends)
- (flymake-log :debug "Backend %s still running, not restarting"
- backend))
- ((memq backend flymake--disabled-backends)
- (flymake-log :debug "Backend %s is disabled, not starting"
- backend))
- (t
- (flymake--run-backend backend))))))
+ (run-hook-wrapped
+ 'flymake-diagnostic-functions
+ (lambda (backend)
+ (cond ((memq backend flymake--running-backends)
+ (flymake-log :debug "Backend %s still running, not
restarting"
+ backend))
+ ((memq backend flymake--disabled-backends)
+ (flymake-log :debug "Backend %s is disabled, not starting"
+ backend))
+ (t
+ (flymake--run-backend backend)))
+ nil))))
(if (and deferred
this-command)
(add-hook 'post-command-hook #'start 'append 'local)
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 38fdbd6 34/39: Capitalize "Flymake" in docstrings and comments, (continued)
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 38fdbd6 34/39: Capitalize "Flymake" in docstrings and comments, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 b80d29d 39/39: Start rewriting Flymake manual, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 b4099cb 18/39: New Flymake API variable flymake-diagnostic-functions, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 a506cc6 25/39: Fix three Flymake bugs when checking C header files, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 de4e13a 17/39: More Flymake cleanup before advancing to backend redesign, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 fd9e32c 15/39: Flymake highlights GCC info/notes as detected by flymake-proc.el, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 be9dd4c 32/39: Improve use of flymake-no-changes-timeout, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 8f0f9cc 28/39: Flymake uses some new fringe bitmaps, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 3ecfe98 35/39: Tweak Flymake autoloads and dependencies, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 26ac964 23/39: A couple of Flymake backends for emacs-lisp-mode, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 fbc6359 31/39: Flymake variable flymake-diagnostic-functions now a special hook,
João Távora <=
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 4a110bf 22/39: Fancy Flymake mode-line construct displays status, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 fc30b6b 19/39: Simplify Flymake logging and erroring, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 6a5e6ad 05/39: Flymake diagnostics now apply to arbitrary buffer regions, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 3169bd9 37/39: Integrate elisp checkers into elisp-mode.el directly, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 1f40144 04/39: Move symbols in flymake-proc.el to separate namespace, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 5f0e3328 30/39: A batch of minor flymake cleanup actions agreed to with Stefan, João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 71776ec 01/39: Split Flymake into flymake.el into flymake-proc.el (again!), João Távora, 2017/10/02
- [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 ea36cec 33/39: Flymake backends can report multiple times per check, João Távora, 2017/10/02