emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/flymake-refactor 7eb2af8 3/4: Call flymake-report


From: João Távora
Subject: [Emacs-diffs] scratch/flymake-refactor 7eb2af8 3/4: Call flymake-report from flymake-post-syntax-check
Date: Tue, 22 Aug 2017 21:38:17 -0400 (EDT)

branch: scratch/flymake-refactor
commit 7eb2af842239aceb5a2846422e37c22bbf152095
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Call flymake-report from flymake-post-syntax-check
    
    * lisp/progmodes/flymake-proc.el (flymake-post-syntax-check):
    Simplify.  Call flymake-report.
    
    * lisp/progmodes/flymake-ui.el (flymake-report): New function.
---
 lisp/progmodes/flymake-proc.el | 37 ++++++++++++-------------------------
 lisp/progmodes/flymake-ui.el   | 17 +++++++++++++++++
 2 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index f00ac1e..3594a63 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 c5b9ee0..6f40bcc 100644
--- a/lisp/progmodes/flymake-ui.el
+++ b/lisp/progmodes/flymake-ui.el
@@ -468,6 +468,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'")
 



reply via email to

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