emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 427bb8d 02/3


From: João Távora
Subject: [Emacs-diffs] scratch/flymake-refactor-cleaner-for-emacs-26 427bb8d 02/39: Flymake provides flymake-report re-entry point for backends
Date: Mon, 2 Oct 2017 20:12:20 -0400 (EDT)

branch: scratch/flymake-refactor-cleaner-for-emacs-26
commit 427bb8dcd1347d4ab6b82eae2dab760b944afdf5
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Flymake provides flymake-report re-entry point for backends
    
    * lisp/progmodes/flymake-proc.el (flymake-post-syntax-check):
    Simplify.  Call flymake-report.
    
    * lisp/progmodes/flymake.el (flymake-report): New function.
---
 lisp/progmodes/flymake-proc.el | 38 +++++++++++++-------------------------
 lisp/progmodes/flymake.el      | 18 ++++++++++++++++++
 2 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 89633fe..63c65c2 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -440,31 +440,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."
@@ -709,6 +696,7 @@ Return its components if so, nil otherwise."
       (flymake-clear-project-include-dirs-cache)
 
       (setq flymake-check-was-interrupted nil)
+      (setq flymake-check-start-time (float-time))
 
       (let* ((source-file-name  buffer-file-name)
              (init-f (flymake-get-init-function source-file-name))
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 441784c..a1b16c0 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -427,6 +427,24 @@ For the format of LINE-ERR-INFO, see 
`flymake-ler-make-ler'."
     (setq flymake-mode-line mode-line)
     (force-mode-line-update)))
 
+(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) "")))))
+
+
 ;; Nothing in flymake uses this at all any more, so this is just for
 ;; third-party compatibility.
 (define-obsolete-function-alias 'flymake-display-warning 'message-box "26.1")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]