[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/flymake-refactor dc39d65 04/52: flymake-ui.el prov
From: |
João Távora |
Subject: |
[Emacs-diffs] scratch/flymake-refactor dc39d65 04/52: flymake-ui.el provides new flymake-report as a re-entry point for backends. |
Date: |
Sun, 1 Oct 2017 12:40:42 -0400 (EDT) |
branch: scratch/flymake-refactor
commit dc39d65adff932cec0a06049a0c4e7b00304d190
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
flymake-ui.el provides new flymake-report as a re-entry point for backends.
* lisp/progmodes/flymake-proc.el (flymake-post-syntax-check):
Simplify. Call flymake-report.
* lisp/progmodes/flymake-ui.el (flymake-report): New function.
(flymake-backends): Tweak docstring.
---
lisp/progmodes/flymake-proc.el | 37 ++++++++++++-------------------------
lisp/progmodes/flymake-ui.el | 24 +++++++++++++++++++++---
2 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 56b1078..8d630dd 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -442,31 +442,18 @@ It's flymake process filter."
(setq flymake-is-running nil))))))))
(defun flymake-post-syntax-check (exit-status command)
- (save-restriction
- (widen)
- (setq flymake-err-info flymake-new-err-info)
- (setq flymake-new-err-info nil)
- (setq flymake-err-info
- (flymake-fix-line-numbers
- flymake-err-info 1 (count-lines (point-min) (point-max))))
- (flymake-delete-own-overlays)
- (flymake-highlight-err-lines flymake-err-info)
- (let (err-count warn-count)
- (setq err-count (flymake-get-err-count flymake-err-info "e"))
- (setq warn-count (flymake-get-err-count flymake-err-info "w"))
- (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)"
- (buffer-name) err-count warn-count
- (- (float-time) flymake-check-start-time))
- (setq flymake-check-start-time nil)
-
- (if (and (equal 0 err-count) (equal 0 warn-count))
- (if (equal 0 exit-status)
- (flymake-report-status "" "") ; PASSED
- (if (not flymake-check-was-interrupted)
- (flymake-report-fatal-status "CFGERR"
- (format "Configuration error has
occurred while running %s" command))
- (flymake-report-status nil ""))) ; "STOPPED"
- (flymake-report-status (format "%d/%d" err-count warn-count) "")))))
+ (let ((err-count (flymake-get-err-count flymake-new-err-info "e"))
+ (warn-count (flymake-get-err-count flymake-new-err-info "w")))
+ (if (equal 0 exit-status)
+ (flymake-report flymake-new-err-info)
+ (if flymake-check-was-interrupted
+ (flymake-report-status nil "") ;; STOPPED
+ (if (and (zerop err-count) (zerop warn-count))
+ (flymake-report-fatal-status "CFGERR"
+ (format "Configuration error has occurred
while running %s" command))
+ (flymake-report flymake-new-err-info))))
+ (setq flymake-new-err-info nil)))
+
(defun flymake-parse-output-and-residual (output)
"Split OUTPUT into lines, merge in residual if necessary."
diff --git a/lisp/progmodes/flymake-ui.el b/lisp/progmodes/flymake-ui.el
index a0864b5..8c7b8a2 100644
--- a/lisp/progmodes/flymake-ui.el
+++ b/lisp/progmodes/flymake-ui.el
@@ -114,9 +114,10 @@ Value is an alist of conses (PREDICATE . CHECKER). Both
PREDICATE
and CHECKER are functions called without arguments and within the
the buffer in which `flymake-mode' was enabled. PREDICATE is
expected to (quickly) return t or nil if the buffer can be
-syntax-checked by CHECKER, in which case it can then perform
-more morose operations, possibly asynchronously." :group
-'flymake :type 'alist)
+syntax-checked by CHECKER, in which case it can then perform more
+morose operations, possibly asynchronously. After it's done,
+CHECKER must invoke `flymake-report' to display the results of
+the syntax check." :group 'flymake :type 'alist)
(defvar-local flymake-timer nil
"Timer for starting syntax check.")
@@ -469,6 +470,23 @@ line number outside the file being compiled."
(setq count (1- count))))
err-info-list)
+(defun flymake-report (diagnostics)
+ (save-restriction
+ (widen)
+ (setq flymake-err-info
+ (flymake-fix-line-numbers
+ diagnostics 1 (count-lines (point-min) (point-max))))
+ (flymake-delete-own-overlays)
+ (flymake-highlight-err-lines flymake-err-info)
+ (let ((err-count (flymake-get-err-count flymake-err-info "e"))
+ (warn-count (flymake-get-err-count flymake-err-info "w")))
+ (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)"
+ (buffer-name) err-count warn-count
+ (- (float-time) flymake-check-start-time))
+ (if (and (equal 0 err-count) (equal 0 warn-count))
+ (flymake-report-status "" "")
+ (flymake-report-status (format "%d/%d" err-count warn-count) "")))))
+
(defvar-local flymake--backend nil
"The currently active backend selected by `flymake-mode'")
- [Emacs-diffs] branch scratch/flymake-refactor created (now 51a2b7b), João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor b30fb9c 03/52: Allow running flymake-tests.el from interactive sessions, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor e7e9d4f 01/52: Fix flymake-backends defcustom's docstring and usage, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 3b06b52 02/52: Adjust flymake's UI/backend split started in earlier commit, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor dc39d65 04/52: flymake-ui.el provides new flymake-report as a re-entry point for backends.,
João Távora <=
- [Emacs-diffs] scratch/flymake-refactor 46e0721 08/52: Fix test failure introduced by previous commit, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 205c444 10/52: Use non-obsolete variable names in flymake-tests.el, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 50a6920 11/52: Make flymake-tests.el friendlier to interactive runs, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 46b4391 16/52: flymake-proc.el parses column numbers from gcc/javac errors, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 4292342 13/52: Further simplify progmodes/flymake-ui.el, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor c5cc7e9 17/52: Make debugging flymake-proc.el easier, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 2693054 14/52: Flymake faces are not just for "lines" anymore, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 991c88f 18/52: flymake-warning face easier to distinguish from flymake-error, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 12aa247 19/52: Protect against timer triggers when no flymake-mode, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 740572e 05/52: Completely rewrite flymake's subprocess output processing, João Távora, 2017/10/01