From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.devel Subject: Re: Flymake refactored Date: Sun, 8 Oct 2017 08:51:56 -0400 Message-ID: <20171008125156.q22u2tya5ygfbwja@logos.localdomain> References: <1507138648.1972.0@smtp.gmail.com> <874lre2von.fsf@gmail.com> <87mv566yjx.fsf@udel.edu> <87shex276r.fsf@gmail.com> <87efqh2sud.fsf@udel.edu> <20171006151753.tmdunffovz7olhey@logos.localdomain> <87h8vbx7p3.fsf@gmail.com> <20171007181824.k6pf2ztgxyodmx4a@logos.localdomain> <87376uxb3s.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1507467164 8293 195.159.176.226 (8 Oct 2017 12:52:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Oct 2017 12:52:44 +0000 (UTC) User-Agent: NeoMutt/20170912-97-b97206-dirty Cc: emacs-devel@gnu.org, Simen =?iso-8859-1?Q?Heggest=F8yl?= , dgutov@yandex.ru, Steve Purcell , sdl.web@gmail.com, monnier@iro.umontreal.ca To: =?iso-8859-1?Q?Jo=E3o_T=E1vora?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 08 14:52:38 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1B4O-0001Bl-A3 for ged-emacs-devel@m.gmane.org; Sun, 08 Oct 2017 14:52:36 +0200 Original-Received: from localhost ([::1]:53691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1B4V-0002KD-NK for ged-emacs-devel@m.gmane.org; Sun, 08 Oct 2017 08:52:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1B3r-0002Jt-Kv for emacs-devel@gnu.org; Sun, 08 Oct 2017 08:52:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1B3n-0006rI-J2 for emacs-devel@gnu.org; Sun, 08 Oct 2017 08:52:03 -0400 Original-Received: from mail-qt0-x22c.google.com ([2607:f8b0:400d:c0d::22c]:45613) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e1B3n-0006r1-CJ for emacs-devel@gnu.org; Sun, 08 Oct 2017 08:51:59 -0400 Original-Received: by mail-qt0-x22c.google.com with SMTP id p1so1443462qtg.2 for ; Sun, 08 Oct 2017 05:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=1M5m3ru/GDPMjTR9r3R/JYCh+hQrTvpS1zAu87QUCi8=; b=IkyfeWyxAqGY95Gy3GhCXVvD+xXpvbWSsTjTp1xy2Xj00vJmQGIPoFW+e5DSAKPkpW D6pV4CdfgbuNnB2+Tjl9TE9Tp1LoeHOXdtR7P25BFxUytxb7oSsoKribYWCqx8Pacoks f0eAcxjJhhtn151sC4XmWOezS2R9CUeWnJ6Z91ixtV0FeFoIII73FQjy/cRkKoBL1M1t llnsOGH97ozwE6ozNPuUR7AFb+oufWnHYXFIBTTmdpGoa+AewkPS4tu/nHDQVa5vYKDc 2rvieo5Imy48LULQuxhgFekraQVQHZkkdGeGcsGIEV0RDDiyTRSZJ/IzvLBzIRoRRDD4 n8yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=1M5m3ru/GDPMjTR9r3R/JYCh+hQrTvpS1zAu87QUCi8=; b=CAt/8j7RufOJm0k6erbCQAxcDasy0mMu5QSKReodgmblLYKdj+DpzDWadLA4sXhyLl qthaMemcB7s6zOasRETcnG4pDnaOEn9zxKpdHUqZekJtLA/Uz0ccnxJp4mHMPa5FQUQ5 RWIolmjnHm+bwtjxgP/uGJzSVB2wwnKy7ZXhWkNGeRpdgjJn8G9VTh4rnOcCWCER6Kxv 0uIsn4CyyqFb9wZ927RJHAOUeBSyFZKN+sbGnIrFtUFf19nw8S3Ft9Vhsyby/xlTXc/f wmOuBpKXpbAggLKVWiNU9wuYI0bmYQDL8OmvmOGHQY/rUmDfCtIOkDuHCULgo/9cyOpl jIMQ== X-Gm-Message-State: AMCzsaUEITyXTEUbMtLcJ0f3SiKLwCf/vOrLpNNoE5CuKzSYl4oBlFHB PlzhmgaBDeTj2a79a2D1pUL3pA== X-Google-Smtp-Source: AOwi7QC09mr0QKf/cRdryeJ2yHPfRF4pvROJ3QyyciGox7EzdiDWlEBkM8WkQj8VfuBKiEjBO52aBA== X-Received: by 10.237.61.49 with SMTP id g46mr10697299qtf.233.1507467118460; Sun, 08 Oct 2017 05:51:58 -0700 (PDT) Original-Received: from logos.localdomain (pool-173-67-36-61.bltmmd.fios.verizon.net. [173.67.36.61]) by smtp.gmail.com with ESMTPSA id e7sm3448303qkf.73.2017.10.08.05.51.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Oct 2017 05:51:57 -0700 (PDT) Content-Disposition: inline In-Reply-To: <87376uxb3s.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219243 Archived-At: On 08/10/17 at 10:06am, João Távora wrote: > Mark Oteiza writes: > > > On 07/10/17 at 05:07pm, João Távora wrote: > >> Mark Oteiza 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