]> git.eshelyaron.com Git - emacs.git/commitdiff
Add interactive flymake-start function
authorJoão Távora <joaotavora@gmail.com>
Wed, 27 Sep 2017 16:47:14 +0000 (17:47 +0100)
committerJoão Távora <joaotavora@gmail.com>
Tue, 3 Oct 2017 13:18:54 +0000 (14:18 +0100)
* lisp/progmodes/flymake.el (flymake-on-timer-event)
(flymake-after-change-function, flymake-mode): Call
flymake-start.
(flymake-start): Rename from flymake--start-syntax-check.

lisp/progmodes/flymake.el

index 8c92dc7e53fdc4e08425e113cf5f1b80a4c6df96..282727e315d2bd31aebee92a7397d64dcfeedbea 100644 (file)
@@ -466,7 +466,7 @@ associated `flymake-category' return DEFAULT."
 
        (setq flymake-last-change-time nil)
        (flymake-log :debug "starting syntax check after no changes for some time")
-       (flymake--start-syntax-check)))))
+       (flymake-start)))))
 
 (define-obsolete-function-alias 'flymake-display-err-menu-for-current-line
   'flymake-popup-current-error-menu "24.4")
@@ -596,15 +596,22 @@ sources."
                                err)
      (flymake--stop-backend backend))))
 
-(defun flymake--start-syntax-check (&optional deferred)
+(defun flymake-start (&optional deferred interactive)
   "Start a syntax check.
 Start it immediately, or after current command if DEFERRED is
-non-nil."
+non-nil.  With optional INTERACTIVE or interactively, clear any
+stale information about running and automatically disabled
+backends."
+  (interactive (list nil t))
   (cl-labels
       ((start
         ()
         (remove-hook 'post-command-hook #'start 'local)
         (setq flymake-check-start-time (float-time))
+        (when interactive
+          (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"
@@ -640,7 +647,7 @@ non-nil."
       (setq flymake--diagnostics-table (make-hash-table))
 
       (when flymake-start-syntax-check-on-find-file
-        (flymake--start-syntax-check)))))
+        (flymake-start)))))
 
    ;; Turning the mode OFF.
    (t
@@ -670,13 +677,13 @@ non-nil."
   (let((new-text (buffer-substring start stop)))
     (when (and flymake-start-syntax-check-on-newline (equal new-text "\n"))
       (flymake-log :debug "starting syntax check as new-line has been seen")
-      (flymake--start-syntax-check 'deferred))
+      (flymake-start 'deferred))
     (setq flymake-last-change-time (float-time))))
 
 (defun flymake-after-save-hook ()
   (when flymake-mode
     (flymake-log :debug "starting syntax check as buffer was saved")
-    (flymake--start-syntax-check))) ; no more mode 3. cannot start check if mode 3 (to temp copies) is active - (???)
+    (flymake-start)))
 
 (defun flymake-kill-buffer-hook ()
   (when flymake-timer