aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJoão Távora2017-10-09 00:12:48 +0100
committerJoão Távora2017-10-10 17:20:01 +0100
commitf9cd8ee681bfaa8a1e96772801afe9df20798a8f (patch)
tree00703ded17de801c67df53ace2ba5f8f8e09ae4e /lisp
parent0e83f5f279b1b2c42dc214c512c0fa0a9b27af35 (diff)
downloademacs-f9cd8ee681bfaa8a1e96772801afe9df20798a8f.tar.gz
emacs-f9cd8ee681bfaa8a1e96772801afe9df20798a8f.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/flymake.el30
1 files changed, 17 insertions, 13 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index bdf784c7a11..6c2a37abd7d 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1079,31 +1079,31 @@ applied."
1079 1079
1080(defvar flymake-diagnostics-buffer-mode-map 1080(defvar flymake-diagnostics-buffer-mode-map
1081 (let ((map (make-sparse-keymap))) 1081 (let ((map (make-sparse-keymap)))
1082 (define-key map [mouse-1] 'flymake-goto-diagnostic-at-point) 1082 (define-key map (kbd "RET") 'flymake-goto-diagnostic)
1083 (define-key map (kbd "RET") 'flymake-goto-diagnostic-at-point) 1083 (define-key map (kbd "SPC") 'flymake-show-diagnostic)
1084 (define-key map (kbd "SPC") 'flymake-show-diagnostic-at-point)
1085 map)) 1084 map))
1086 1085
1087(defun flymake-show-diagnostic-at-point () 1086(defun flymake-show-diagnostic (pos &optional other-window)
1088 "Show location of diagnostic at point." 1087 "Show location of diagnostic at POS."
1089 (interactive) 1088 (interactive (list (point) t))
1090 (let* ((id (or (tabulated-list-get-id) 1089 (let* ((id (or (tabulated-list-get-id pos)
1091 (user-error "Nothing at point"))) 1090 (user-error "Nothing at point")))
1092 (overlay (plist-get id :overlay))) 1091 (overlay (plist-get id :overlay)))
1093 (with-current-buffer (overlay-buffer overlay) 1092 (with-current-buffer (overlay-buffer overlay)
1094 (with-selected-window 1093 (with-selected-window
1095 (display-buffer (current-buffer)) 1094 (display-buffer (current-buffer) other-window)
1096 (goto-char (overlay-start overlay)) 1095 (goto-char (overlay-start overlay))
1097 (pulse-momentary-highlight-region (overlay-start overlay) 1096 (pulse-momentary-highlight-region (overlay-start overlay)
1098 (overlay-end overlay) 1097 (overlay-end overlay)
1099 'highlight)) 1098 'highlight))
1100 (current-buffer)))) 1099 (current-buffer))))
1101 1100
1102(defun flymake-goto-diagnostic-at-point () 1101(defun flymake-goto-diagnostic (pos)
1103 "Show location of diagnostic at point." 1102 "Show location of diagnostic at POS.
1104 (interactive) 1103POS can be a buffer position or a button"
1104 (interactive "d")
1105 (pop-to-buffer 1105 (pop-to-buffer
1106 (flymake-show-diagnostic-at-point))) 1106 (flymake-show-diagnostic (if (button-type pos) (button-start pos) pos))))
1107 1107
1108(defun flymake--diagnostics-buffer-entries () 1108(defun flymake--diagnostics-buffer-entries ()
1109 (with-current-buffer flymake--diagnostics-buffer-source 1109 (with-current-buffer flymake--diagnostics-buffer-source
@@ -1128,7 +1128,11 @@ applied."
1128 ,(propertize (format "%s" type) 1128 ,(propertize (format "%s" type)
1129 'face (flymake--lookup-type-property 1129 'face (flymake--lookup-type-property
1130 type 'mode-line-face 'flymake-error)) 1130 type 'mode-line-face 'flymake-error))
1131 ,(format "%s" (flymake--diag-text diag))])))) 1131 (,(format "%s" (flymake--diag-text diag))
1132 mouse-face highlight
1133 help-echo "mouse-2: visit this diagnostic"
1134 face nil
1135 mouse-action flymake-goto-diagnostic)]))))
1132 1136
1133(define-derived-mode flymake-diagnostics-buffer-mode tabulated-list-mode 1137(define-derived-mode flymake-diagnostics-buffer-mode tabulated-list-mode
1134 "Flymake diagnostics" 1138 "Flymake diagnostics"