From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#40529: 26.3; global-display-line-numbers-mode and flymake-show-diagnostics-buffer error Date: Sun, 12 Apr 2020 20:15:08 +0300 Message-ID: <83wo6kk4mb.fsf@gnu.org> References: <83v9m7n98j.fsf@gnu.org> <83r1wvmt7k.fsf@gnu.org> <83ftdbmjan.fsf@gnu.org> <837dyklszu.fsf@gnu.org> <833698lq9o.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="58854"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 40529@debbugs.gnu.org, nadiasggeb001@gmail.com To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 12 19:16:30 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNgDe-000FCL-6D for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 19:16:30 +0200 Original-Received: from localhost ([::1]:35388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNgDc-0006D4-4r for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 13:16:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48225) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNgDG-0006Bj-Lb for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:16:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNgDC-00029k-4u for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:16:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47232) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jNgDC-00029R-0p for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jNgDB-00064M-R6 for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 13:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Apr 2020 17:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40529 X-GNU-PR-Package: emacs Original-Received: via spool by 40529-submit@debbugs.gnu.org id=B40529.158671172823270 (code B ref 40529); Sun, 12 Apr 2020 17:16:01 +0000 Original-Received: (at 40529) by debbugs.gnu.org; 12 Apr 2020 17:15:28 +0000 Original-Received: from localhost ([127.0.0.1]:58774 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNgCd-00063G-KP for submit@debbugs.gnu.org; Sun, 12 Apr 2020 13:15:27 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33037) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNgCb-000633-LB for 40529@debbugs.gnu.org; Sun, 12 Apr 2020 13:15:26 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:33326) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jNgCW-0001S0-Go; Sun, 12 Apr 2020 13:15:20 -0400 Original-Received: from [176.228.60.248] (port=1436 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jNgCV-0007Dd-GG; Sun, 12 Apr 2020 13:15:20 -0400 In-Reply-To: (message from =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= on Sun, 12 Apr 2020 17:58:16 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:178267 Archived-At: > From: João Távora > Date: Sun, 12 Apr 2020 17:58:16 +0100 > Cc: Aidan Beggs , 40529@debbugs.gnu.org > > > I'm sure a simple solution for Flymake can be found. E.g., what about > > skipping the entire body of flymake--diagnostics-buffer-entries if > > flymake--diagnostics-buffer-source is nil > > Maybe that works, yes. Feel free to try it and commit it > to Emacs 27, I have little time and I'm booted into a machine > with no Emacs. OK. Aidan, can you try the patch below and see if it solves the problem? The initial error in the recipe you posted is definitely gone after applying the patch, but please also try this after that and see that flymake-show-diagnostics-buffer also works after that, in real-life use. Thanks. diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 25a2152..b37b72e 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1321,35 +1321,36 @@ flymake-goto-diagnostic (flymake-show-diagnostic (if (button-type pos) (button-start pos) pos)))) (defun flymake--diagnostics-buffer-entries () - (with-current-buffer flymake--diagnostics-buffer-source - (cl-loop for diag in - (cl-sort (flymake-diagnostics) #'< :key #'flymake-diagnostic-beg) - for (line . col) = - (save-excursion - (goto-char (flymake--diag-beg diag)) - (cons (line-number-at-pos) - (- (point) - (line-beginning-position)))) - for type = (flymake--diag-type diag) - collect - (list (list :diagnostic diag - :line line - :severity (flymake--lookup-type-property - type - 'severity (warning-numeric-level :error))) - `[,(format "%s" line) - ,(format "%s" col) - ,(propertize (format "%s" - (flymake--lookup-type-property - type 'flymake-type-name type)) - 'face (flymake--lookup-type-property - type 'mode-line-face 'flymake-error)) - (,(format "%s" (flymake--diag-text diag)) - mouse-face highlight - help-echo "mouse-2: visit this diagnostic" - face nil - action flymake-goto-diagnostic - mouse-action flymake-goto-diagnostic)])))) + (when (bufferp flymake--diagnostics-buffer-source) + (with-current-buffer flymake--diagnostics-buffer-source + (cl-loop for diag in + (cl-sort (flymake-diagnostics) #'< :key #'flymake-diagnostic-beg) + for (line . col) = + (save-excursion + (goto-char (flymake--diag-beg diag)) + (cons (line-number-at-pos) + (- (point) + (line-beginning-position)))) + for type = (flymake--diag-type diag) + collect + (list (list :diagnostic diag + :line line + :severity (flymake--lookup-type-property + type + 'severity (warning-numeric-level :error))) + `[,(format "%s" line) + ,(format "%s" col) + ,(propertize (format "%s" + (flymake--lookup-type-property + type 'flymake-type-name type)) + 'face (flymake--lookup-type-property + type 'mode-line-face 'flymake-error)) + (,(format "%s" (flymake--diag-text diag)) + mouse-face highlight + help-echo "mouse-2: visit this diagnostic" + face nil + action flymake-goto-diagnostic + mouse-action flymake-goto-diagnostic)]))))) (define-derived-mode flymake-diagnostics-buffer-mode tabulated-list-mode "Flymake diagnostics"