all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: joaotavora@gmail.com (João Távora)
To: Mark Oteiza <mvoteiza@udel.edu>
Cc: emacs-devel@gnu.org, "Simen Heggestøyl" <simenheg@gmail.com>,
	dgutov@yandex.ru, "Steve Purcell" <steve@sanityinc.com>,
	sdl.web@gmail.com, monnier@iro.umontreal.ca
Subject: Re: Flymake refactored
Date: Mon, 09 Oct 2017 00:21:07 +0100	[thread overview]
Message-ID: <87mv51w7j0.fsf@gmail.com> (raw)
In-Reply-To: <20171008125156.q22u2tya5ygfbwja@logos.localdomain> (Mark Oteiza's message of "Sun, 8 Oct 2017 08:51:56 -0400")

Mark Oteiza <mvoteiza@udel.edu> writes:

>> Agree, makes sense. But this seems akward to do in
>> tabulated-list-mode. I don't mind if you beat me to it :-)
>
> Patch below :)

Thanks, applied it. But tweaked it again (patch below) to at least have
mouse-face 'highlight on the message when hovering on it. This is
slightly more complicated but more in line with what the Elisp manual
node seems to suggest doing in "Clickable Text" (there seems to be more
than one way tho).

Feel free to tweak again and push to the
scratch/flymake-diagnostics-buffer branch.

> Probably overkill, but my best example is the Freefem++ manual: an 860

Yes, 10 minutes is overkill, but we can probably scale it to 10% or
so. Unfortunately, I don't have time to work on this properly now, so
don't hold back :-)

João

commit 9412afa5f601f0d3f6d6d094bf5b918a41a3e136
Author: João Távora <joaotavora@gmail.com>
Date:   Mon Oct 9 00:12:48 2017 +0100

    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.

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index fb5fc7db12..6796fc2b76 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -990,31 +990,31 @@ flymake--diagnostics-buffer-source
 
 (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
@@ -1039,7 +1039,11 @@ flymake--diagnostics-buffer-entries
                      ,(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	other threads:[~2017-10-08 23:21 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 14:27 Flymake refactored João Távora
2017-09-28 19:52 ` Stefan Monnier
2017-09-29  0:22   ` João Távora
2017-09-29  3:11     ` Stefan Monnier
2017-10-01 16:52       ` João Távora
2017-10-01 20:50         ` Stefan Monnier
2017-10-02  1:01           ` João Távora
2017-10-02  3:12             ` Stefan Monnier
2017-10-03  0:33               ` João Távora
2017-10-03  1:09                 ` Stefan Monnier
2017-09-29 12:51   ` Dmitry Gutov
2017-09-29 14:55     ` Ted Zlatanov
2017-09-29 15:03       ` Dmitry Gutov
2017-09-29 16:26         ` Ted Zlatanov
2017-09-29 17:35           ` Dmitry Gutov
2017-09-29 17:56             ` Ted Zlatanov
2017-09-30 15:07               ` Dmitry Gutov
2017-09-30  7:55 ` Marcin Borkowski
2017-09-30 23:43   ` João Távora
2017-10-01  8:53     ` Marcin Borkowski
2017-10-01 11:54       ` Mark Oteiza
2017-10-04 17:37 ` Simen Heggestøyl
2017-10-05  2:08   ` João Távora
2017-10-05  3:52     ` Mark Oteiza
2017-10-05 10:57       ` João Távora
2017-10-05 13:11         ` Stefan Monnier
2017-10-05 14:45           ` João Távora
2017-10-05 23:01             ` João Távora
2017-10-05 21:22         ` Mark Oteiza
2017-10-05 23:05           ` João Távora
2017-10-06  3:35             ` Stefan Monnier
2017-10-06  7:09               ` Lele Gaifax
2017-10-06  8:14                 ` Eli Zaretskii
2017-10-06  8:19                   ` Lele Gaifax
2017-10-06  9:48                     ` Eli Zaretskii
2017-10-06  9:54                       ` Lele Gaifax
2017-10-06 13:04                 ` Mark Oteiza
2017-10-06 14:47                   ` Lele Gaifax
2017-10-06 15:21                     ` Mark Oteiza
2017-10-06 15:26                       ` Mark Oteiza
2017-10-06 15:28                       ` Lele Gaifax
2017-10-06 16:28                         ` João Távora
2017-10-06 19:24                           ` Lele Gaifax
2017-10-06 15:13               ` João Távora
2017-10-07 13:28                 ` Stefan Monnier
2017-10-07 13:44                   ` Eli Zaretskii
2017-10-07 14:40                     ` Lele Gaifax
2017-10-07 14:52                       ` Eli Zaretskii
2017-10-08  2:06                       ` Stefan Monnier
2017-10-08  9:32                         ` João Távora
2017-10-08 11:24                           ` Lele Gaifax
2017-10-08 14:17                           ` Stefan Monnier
2017-10-08 23:33                             ` João Távora
2017-10-09  3:01                               ` Stefan Monnier
2017-10-09 10:19                                 ` João Távora
2017-10-09 15:50                                   ` [SUSPECTED SPAM] " Stefan Monnier
2017-10-09 16:33                                   ` [PATCH] " Lele Gaifax
2017-10-07  6:31               ` Marcin Borkowski
2017-10-07 13:37                 ` Stefan Monnier
2017-10-07 16:48                   ` Marcin Borkowski
2017-10-06 12:54           ` John Wiegley
2017-10-06 15:17             ` Mark Oteiza
2017-10-06 16:04               ` João Távora
2017-10-06 21:22                 ` Mark Oteiza
2017-10-06 22:03                   ` João Távora
2017-10-07 13:31               ` Stefan Monnier
2017-10-07 16:02                 ` João Távora
2017-10-07 16:07               ` João Távora
2017-10-07 18:18                 ` Mark Oteiza
2017-10-08  9:06                   ` João Távora
2017-10-08 12:51                     ` Mark Oteiza
2017-10-08 23:21                       ` João Távora [this message]
2017-10-10 14:27                         ` Mark Oteiza
2017-10-10 15:20                           ` João Távora
2017-10-10 16:10                             ` Mark Oteiza
2017-10-05 11:28     ` Lele Gaifax
2017-10-05 15:12       ` Lele Gaifax
2017-10-10 10:40 ` Lele Gaifax
2017-10-10 12:27   ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mv51w7j0.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=mvoteiza@udel.edu \
    --cc=sdl.web@gmail.com \
    --cc=simenheg@gmail.com \
    --cc=steve@sanityinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.