emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 21e7075 1/5: Make three new Flymake commands for


From: João Távora
Subject: [Emacs-diffs] emacs-26 21e7075 1/5: Make three new Flymake commands for debugging common problems
Date: Tue, 10 Oct 2017 08:11:41 -0400 (EDT)

branch: emacs-26
commit 21e7075781c13bebfac64ed2a2c9749315f9aa1a
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Make three new Flymake commands for debugging common problems
    
    * lisp/progmodes/flymake.el (flymake-running-backends)
    (flymake-disabled-backends)
    (flymake-reporting-backends): Make interactive.
    (flymake--collect): Take optional arg.
---
 lisp/progmodes/flymake.el | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 27ec7a1..53ce73e 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -622,24 +622,42 @@ different runs of the same backend."
         (with-current-buffer buffer
           (apply #'flymake--handle-report backend token args))))))
 
-(defun flymake--collect (fn)
+(defun flymake--collect (fn &optional message-prefix)
+  "Collect Flymake backends matching FN.
+If MESSAGE-PREFIX, echo a message using that prefix"
+  (unless flymake--backend-state
+    (user-error "Flymake is not initialized"))
   (let (retval)
     (maphash (lambda (backend state)
                (when (funcall fn state) (push backend retval)))
              flymake--backend-state)
+    (when message-prefix
+      (message "%s%s"
+               message-prefix
+               (mapconcat (lambda (s) (format "%s" s))
+                          retval ", ")))
     retval))
 
 (defun flymake-running-backends ()
   "Compute running Flymake backends in current buffer."
-  (flymake--collect #'flymake--backend-state-running))
+  (interactive)
+  (flymake--collect #'flymake--backend-state-running
+                    (and (called-interactively-p 'interactive)
+                         "Running backends: ")))
 
 (defun flymake-disabled-backends ()
   "Compute disabled Flymake backends in current buffer."
-  (flymake--collect #'flymake--backend-state-disabled))
+  (interactive)
+  (flymake--collect #'flymake--backend-state-disabled
+                    (and (called-interactively-p 'interactive)
+                         "Disabled backends: ")))
 
 (defun flymake-reporting-backends ()
   "Compute reporting Flymake backends in current buffer."
-  (flymake--collect #'flymake--backend-state-reported-p))
+  (interactive)
+  (flymake--collect #'flymake--backend-state-reported-p
+                    (and (called-interactively-p 'interactive)
+                         "Reporting backends: ")))
 
 (defun flymake--disable-backend (backend &optional explanation)
   "Disable BACKEND because EXPLANATION.



reply via email to

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