emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 f9cd8ee 3/5: Tweak the Flymake diagnostics buffer


From: João Távora
Subject: [Emacs-diffs] emacs-26 f9cd8ee 3/5: Tweak the Flymake diagnostics buffer again
Date: Tue, 10 Oct 2017 12:21:46 -0400 (EDT)

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

    Tweak the Flymake diagnostics buffer again
    
    * lisp/progmodes/flymake.el
    (flymake-diagnostics-buffer-mode-map): Don't bind [mouse-1].
    (flymake-show-diagnostic): Rename from
    flymake-show-diagnostic-at-point.  Really use another window.
    (flymake-goto-diagnostic): Rename from
    flymake-goto-diagnostic-at-point.
    (flymake--diagnostics-buffer-entries): Use a button just for
    the message bit.
---
 lisp/progmodes/flymake.el | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index bdf784c..6c2a37a 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1079,31 +1079,31 @@ applied."
 
 (defvar flymake-diagnostics-buffer-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [mouse-1] 'flymake-goto-diagnostic-at-point)
-    (define-key map (kbd "RET") 'flymake-goto-diagnostic-at-point)
-    (define-key map (kbd "SPC") 'flymake-show-diagnostic-at-point)
+    (define-key map (kbd "RET") 'flymake-goto-diagnostic)
+    (define-key map (kbd "SPC") 'flymake-show-diagnostic)
     map))
 
-(defun flymake-show-diagnostic-at-point ()
-  "Show location of diagnostic at point."
-  (interactive)
-  (let* ((id (or (tabulated-list-get-id)
+(defun flymake-show-diagnostic (pos &optional other-window)
+  "Show location of diagnostic at POS."
+  (interactive (list (point) t))
+  (let* ((id (or (tabulated-list-get-id pos)
                  (user-error "Nothing at point")))
          (overlay (plist-get id :overlay)))
     (with-current-buffer (overlay-buffer overlay)
       (with-selected-window
-          (display-buffer (current-buffer))
+          (display-buffer (current-buffer) other-window)
         (goto-char (overlay-start overlay))
         (pulse-momentary-highlight-region (overlay-start overlay)
                                           (overlay-end overlay)
                                           'highlight))
       (current-buffer))))
 
-(defun flymake-goto-diagnostic-at-point ()
-  "Show location of diagnostic at point."
-  (interactive)
+(defun flymake-goto-diagnostic (pos)
+  "Show location of diagnostic at POS.
+POS can be a buffer position or a button"
+  (interactive "d")
   (pop-to-buffer
-   (flymake-show-diagnostic-at-point)))
+   (flymake-show-diagnostic (if (button-type pos) (button-start pos) pos))))
 
 (defun flymake--diagnostics-buffer-entries ()
   (with-current-buffer flymake--diagnostics-buffer-source
@@ -1128,7 +1128,11 @@ applied."
                      ,(propertize (format "%s" type)
                                   'face (flymake--lookup-type-property
                                          type 'mode-line-face 'flymake-error))
-                     ,(format "%s" (flymake--diag-text diag))]))))
+                     (,(format "%s" (flymake--diag-text diag))
+                      mouse-face highlight
+                      help-echo "mouse-2: visit this diagnostic"
+                      face nil
+                      mouse-action flymake-goto-diagnostic)]))))
 
 (define-derived-mode flymake-diagnostics-buffer-mode tabulated-list-mode
   "Flymake diagnostics"



reply via email to

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