From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: Flymake refactored Date: Mon, 09 Oct 2017 00:21:07 +0100 Message-ID: <87mv51w7j0.fsf@gmail.com> 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> <20171008125156.q22u2tya5ygfbwja@logos.localdomain> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1507504890 28483 195.159.176.226 (8 Oct 2017 23:21:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 8 Oct 2017 23:21:30 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) Cc: emacs-devel@gnu.org, Simen =?utf-8?Q?Heggest=C3=B8yl?= , dgutov@yandex.ru, Steve Purcell , sdl.web@gmail.com, monnier@iro.umontreal.ca To: Mark Oteiza Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 09 01:21:26 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 1e1Ksm-0005mL-Rv for ged-emacs-devel@m.gmane.org; Mon, 09 Oct 2017 01:21:17 +0200 Original-Received: from localhost ([::1]:55424 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1Ksu-0004jG-4k for ged-emacs-devel@m.gmane.org; Sun, 08 Oct 2017 19:21:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1Ksm-0004jB-8e for emacs-devel@gnu.org; Sun, 08 Oct 2017 19:21:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1Ksi-0003wC-9u for emacs-devel@gnu.org; Sun, 08 Oct 2017 19:21:16 -0400 Original-Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35472) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e1Ksh-0003vf-W2 for emacs-devel@gnu.org; Sun, 08 Oct 2017 19:21:12 -0400 Original-Received: by mail-wm0-x243.google.com with SMTP id b189so18580308wmd.2 for ; Sun, 08 Oct 2017 16:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=2ONQH1FhtZife6bRqukMalfpnI07q8xKja+0RjYxXF0=; b=l5qlt/zdNX/owO5zWhWIj9/DAOUTqqiAPJsXATJexPmstCUDk623s4v0UI7KUQ+oDt A/4ER06exAYIhQ9jMKc3iGuI/YhjZzWjyyfVLQJAfaBx2crUYnSfxppXsoSemaKudzFQ +d7VdyE0viw8jXFcl/Dywvza2/FfGCgV4r6uMmOTF1afAEaAPKg9MVVWvB+noX5lfikM iCbwIz55GnN/ZT8JPnHff1FskCFy7G/n+/+ADojCGql5eAFKstOjNqTNBAwCsxnXaws1 GvNOBM5u5AIFkiN+M+rANH3bWXIN7TcL54iSvCfns0XJDCPno1y1cSevQNJ758YOYK/B Da4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=2ONQH1FhtZife6bRqukMalfpnI07q8xKja+0RjYxXF0=; b=WpGPFd5aoN6N8Ryv3cJR8l/Z29/4VYwVSBuF3whHVsBuafZqkZJEwWOySwlfbhjW6y WDln1oxZOcY9DxlX38z3sI7eQgv63H0bFYjb1beSqJwKR56x7FVsf4qb4x/KIlT26fZ+ VgmEqIP9lTmsaVXK0ZlM/2LNydDiuxbyzihEdwkXwphnO9pyyKVInJHorAGVkPuwg8o/ 2SIPP0p/B1eNw4yEHhNKbM39RZtojSrJD73xaxsIp3BQlBgVwLQ7I6+i+eKxxjdXhiJz t8mEYfS70538k9A7AyPmE1wscuiV/lytQf/Jtj/TaHgnOgUNnd2aIVPGACU92ClTdHWs il0w== X-Gm-Message-State: AMCzsaUqvghE/LAtcrZiDbBCKzNK5MhhLzcTgmOLCJlsw8ZXSPCAdWbq 9pnxwPBIX9x+l+3Mnm6EhGE= X-Google-Smtp-Source: AOwi7QCH+E224j160ifDqb/3eX8IFd5QqPDNM9gm2dmJkj914dPp77c/LV3Z/tflE8tBAr5e8NovDQ== X-Received: by 10.223.133.99 with SMTP id 90mr875575wrh.101.1507504870635; Sun, 08 Oct 2017 16:21:10 -0700 (PDT) Original-Received: from lolita.yourcompany.com (188.139.62.94.rev.vodafone.pt. [94.62.139.188]) by smtp.gmail.com with ESMTPSA id p13sm2206997wre.24.2017.10.08.16.21.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 08 Oct 2017 16:21:09 -0700 (PDT) In-Reply-To: <20171008125156.q22u2tya5ygfbwja@logos.localdomain> (Mark Oteiza's message of "Sun, 8 Oct 2017 08:51:56 -0400") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 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:219279 Archived-At: Mark Oteiza 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=C3=A3o commit 9412afa5f601f0d3f6d6d094bf5b918a41a3e136 Author: Jo=C3=A3o T=C3=A1vora Date: Mon Oct 9 00:12:48 2017 +0100 Tweak the Flymake diagnostics buffer again =20=20=20=20 * 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 =20 (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)) =20 -(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)))) =20 -(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))= )) =20 (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-err= or)) - ,(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)])))) =20 (define-derived-mode flymake-diagnostics-buffer-mode tabulated-list-mode "Flymake diagnostics"