unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: "João Távora" <joaotavora@gmail.com>
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: Sun, 8 Oct 2017 08:51:56 -0400	[thread overview]
Message-ID: <20171008125156.q22u2tya5ygfbwja@logos.localdomain> (raw)
In-Reply-To: <87376uxb3s.fsf@gmail.com>

On 08/10/17 at 10:06am, João Távora wrote:
> Mark Oteiza <mvoteiza@udel.edu> writes:
> 
> > On 07/10/17 at 05:07pm, João Távora wrote:
> >> Mark Oteiza <mvoteiza@udel.edu> writes:
> >> 
> >> > Sure, I've been reading flycheck and syntastic (analogous package for
> >> > vim) for reference.
> >> >
> >> > There are some things aside from checkers I think flymake should learn
> >> > from flycheck--may as well list some here:
> >> > [...]
> >> > - popup a special buffer with all the error/warning/info listed
> >> 
> >> Please have a look at the scratch/flymake-diagnostics-buffer branch and
> >> tell me what you think (perhaps comparing it to Flycheck's). The command
> >> is flymake-show-diagnostics-buffer.
> >> 
> >> It's very naively implemented for now (and seems kinda slow).
> >
> > Looks good, I'd just change from using buttons to having the whole line
> > be usable to navigate to the error.
> 
> 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 :)

> > I suspect it's the use of overlays making it slow--I don't think you
> > need overlays at all for this--just store what you need in the
> > tabulated-list id which IIRC gets applied to the whole line as a text
> > property, which you can then use with (tabulated-list-get-id)
> 
> But it doesn't make any new overlays, if that was your idea. The
> overlays used are the ones in the source buffer, where they can hardly
> be avoided. Using them here seemed like the easiest and fastest way to
> get to all Flymake diagnostics in a buffer.

Oh true, my mistake.

> I might have exaggerated the performance hit, since it doesn't seem so
> slow to me now. Perhaps we could get some big files full of errors and
> run some benchmarks with a proper backend that can be found in Flycheck,
> too.

Probably overkill, but my best example is the Freefem++ manual: an 860
kB, 21k-line .tex file which triggers thousands of warnings in
chktex(1).

It took about ten minutes for flycheck to check it (vs a few seconds to
make the diagnostic list), and you have to set
flycheck-checker-error-threshold to nil in order to prevent flycheck
from disabling the checker.  This is one thing I _don't_ like about
flycheck--I would like the ability to at least truncate results.

It doesn't look like they have a browsable repository.  You'll find it
as DOC/freefem++doc.tex in the latest tarball.
http://www.freefem.org/ff++/ftp/freefem++-3.56-1.tar.gz

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 24b1950c1a..fb5fc7db12 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -988,17 +988,19 @@ flymake--mode-line-format
 
 (defvar-local flymake--diagnostics-buffer-source nil)
 
-(defvar flymake--diagnostics-buffer-button-keymap
+(defvar flymake-diagnostics-buffer-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [mouse-1] 'push-button)
-    (define-key map (kbd "RET") 'push-button)
+    (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)
     map))
 
-(defun flymake-show-diagnostic-at-point (button)
-  "Show location of diagnostic of BUTTON."
-  (interactive (list (button-at (point))))
-  (let* ((overlay (button-get button 'flymake-overlay)))
+(defun flymake-show-diagnostic-at-point ()
+  "Show location of diagnostic at point."
+  (interactive)
+  (let* ((id (or (tabulated-list-get-id)
+                 (user-error "Nothing at point")))
+         (overlay (plist-get id :overlay)))
     (with-current-buffer (overlay-buffer overlay)
       (with-selected-window
           (display-buffer (current-buffer))
@@ -1008,11 +1010,11 @@ flymake-show-diagnostic-at-point
                                           'highlight))
       (current-buffer))))
 
-(defun flymake-goto-diagnostic-at-point (button)
-  "Show location of diagnostic of BUTTON."
-  (interactive (list (button-at (point))))
+(defun flymake-goto-diagnostic-at-point ()
+  "Show location of diagnostic at point."
+  (interactive)
   (pop-to-buffer
-   (flymake-show-diagnostic-at-point button)))
+   (flymake-show-diagnostic-at-point)))
 
 (defun flymake--diagnostics-buffer-entries ()
   (with-current-buffer flymake--diagnostics-buffer-source
@@ -1032,16 +1034,7 @@ flymake--diagnostics-buffer-entries
                          :severity (flymake--lookup-type-property
                                     type
                                     'severity (warning-numeric-level :error)))
-                   `[(,(format "%s" line)
-                      keymap ,flymake--diagnostics-buffer-button-keymap
-                      action flymake-goto-diagnostic-at-point
-                      mouse-action flymake-goto-diagnostic-at-point
-                      help-echo ,(mapconcat #'identity
-                                            '("mouse-1, RET: goto location at point"
-                                              "SPC: show location at point")
-                                            "\n")
-                      flymake-diagnostic ,diag
-                      flymake-overlay ,ov)
+                   `[,(format "%s" line)
                      ,(format "%s" col)
                      ,(propertize (format "%s" type)
                                   'face (flymake--lookup-type-property



  reply	other threads:[~2017-10-08 12:51 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 [this message]
2017-10-08 23:21                       ` João Távora
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20171008125156.q22u2tya5ygfbwja@logos.localdomain \
    --to=mvoteiza@udel.edu \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).