GNU bug report logs - #30674
27.0.50; flymake-mode should set next-error-function and (probably) next-error-last-buffer

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Fri, 2 Mar 2018 01:16:02 UTC

Severity: wishlist

Found in version 27.0.50

To reply to this bug, email your comments to 30674 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to juri <at> linkov.net, bug-gnu-emacs <at> gnu.org:
bug#30674; Package emacs. (Fri, 02 Mar 2018 01:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dmitry Gutov <dgutov <at> yandex.ru>:
New bug report received and forwarded. Copy sent to juri <at> linkov.net, bug-gnu-emacs <at> gnu.org. (Fri, 02 Mar 2018 01:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; flymake-mode should set next-error-function and (probably)
 next-error-last-buffer
Date: Fri, 2 Mar 2018 03:15:26 +0200
X-Debbugs-CC: joaotavora <at> gmail.com
X-Debbugs-CC: juri <at> linkov.net

Considering the names and docstrings of next-error and previous-error, I
think it's quite reasonable to expect to be able to navigate the Flymake
diagnostics with them.

João, was there a particular reason you decided against it? Can we
improve next-error somehow, for this to become more appealing?

Juri, any thoughts? The foremost apparent difficulty is that virtually
any file-editing buffer can become a next-error capable buffer. Would
opening a new file interactively (with flymake-mode being turned on)
automatically change next-error-last-buffer? Would it change after
save-buffer (after which diagnostics are normally refreshed)?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30674; Package emacs. (Tue, 06 Mar 2018 23:08:02 GMT) Full text and rfc822 format available.

Message #8 received at 30674 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 30674 <at> debbugs.gnu.org
Subject: Re: bug#30674: 27.0.50;
 flymake-mode should set next-error-function and (probably)
 next-error-last-buffer
Date: Wed, 07 Mar 2018 00:33:59 +0200
> Considering the names and docstrings of next-error and previous-error, I
> think it's quite reasonable to expect to be able to navigate the Flymake
> diagnostics with them.
>
> João, was there a particular reason you decided against it? Can we
> improve next-error somehow, for this to become more appealing?
>
> Juri, any thoughts? The foremost apparent difficulty is that virtually
> any file-editing buffer can become a next-error capable buffer. Would
> opening a new file interactively (with flymake-mode being turned on)
> automatically change next-error-last-buffer? Would it change after
> save-buffer (after which diagnostics are normally refreshed)?

I think it would be a natural fit into the next-error framework.  How to
solve conflicts with other sources of next-error is an open question.
For example, after running ‘occur’ on the flymake-mode enabled buffer
next-error should continue navigating ‘occur’ hits.  I guess to cancel
such navigation is possible in at least three ways: doing window-quit
on the *Occur* buffer, or using next-error-select-buffer selecting
the current buffer (instead of the *Occur* buffer), or re-running flymake
on the buffer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30674; Package emacs. (Tue, 13 Mar 2018 00:45:02 GMT) Full text and rfc822 format available.

Message #11 received at 30674 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Juri Linkov <juri <at> linkov.net>
Cc: 30674 <at> debbugs.gnu.org
Subject: Re: bug#30674: 27.0.50; flymake-mode should set next-error-function
 and (probably) next-error-last-buffer
Date: Tue, 13 Mar 2018 02:43:56 +0200
On 3/7/18 12:33 AM, Juri Linkov wrote:

> I think it would be a natural fit into the next-error framework.  How to
> solve conflicts with other sources of next-error is an open question.
> For example, after running ‘occur’ on the flymake-mode enabled buffer
> next-error should continue navigating ‘occur’ hits.

Right. That creates tradeoffs, which in turn push against the 
flexibility of next-error-find-buffer-function: it's going to more than 
aesthetic choice now.

So I wonder which particular scheme, or schemes, people actually prefer. 
Or which they'd understand more quickly, just by experimenting (that 
might be the best default).

> I guess to cancel
> such navigation is possible in at least three ways: doing window-quit
> on the *Occur* buffer,

For this, next-error-find-buffer-function should be set to 
#'next-error-buffer-on-selected-frame. Or will we have a separate 
predicate function for whether to use the "local" next-error-function?

> or using next-error-select-buffer selecting
> the current buffer (instead of the *Occur* buffer),

That might be too tedious, having to do that for every 
buffer-with-local-errors you switch to and try to edit (and fix 
errors/warnings in).

However, if we special-case the nil value of next-error-last-buffer, it 
might not be so tedious: you switch away from the last Occur/Grep/etc 
buffer with one invocation, and go on editing multiple files.

This is where buffer-local (or window-local) values of 
next-error-last-buffer might bring undesirable behavior: if one of those 
multiple files was another navigation target from an Occur/Grep/etc 
navigation, or if we switch to a window that was the target (in the 
window-local case), the user will need another next-error-select-buffer 
invocation, and they won't know that until their next-error call brings 
them somewhere unexpected (and only winner-mode will help undo that).

There can be other approaches, such as when there's no visible 
global-next-error-capable buffers, and the current one is 
next-error-capable, use it, as long as there are local errors in the 
given direction, and then switch over to the global navigation.

> or re-running flymake
> on the buffer.

That might be annoying: it runs every time a buffer is saved (and even 
right after it's visited if flymake-start-on-flymake-mode is non-nil).

But hey, it can also be a fine approach, as long as 
flymake-start-on-flymake-mode is nil. Recalling that the first idea is 
to only use a global navigation as long as its buffer is visible, let's 
imagine that it's also so in this case. Grep tries very hard to stay 
visible.

So, we run Grep, jump from it to a source file, start editing. Flymake 
runs, shows some warnings. If the user fixes them all, maybe switch back 
to the global navigation automatically; if not, select Grep's window and 
manually navigate to the next error in the list using one of its 
"buttons" (which also sets next-error-last-buffer). And if the 
navigation buffer is not visible, the user can call 
next-error-select-buffer anyway.

This can work well, as long as the user understands what's going on.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30674; Package emacs. (Tue, 13 Mar 2018 23:25:01 GMT) Full text and rfc822 format available.

Message #14 received at 30674 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 30674 <at> debbugs.gnu.org
Subject: Re: bug#30674: 27.0.50;
 flymake-mode should set next-error-function and (probably)
 next-error-last-buffer
Date: Wed, 14 Mar 2018 00:23:45 +0200
>> I guess to cancel such navigation is possible in at least three ways:
>> doing window-quit on the *Occur* buffer,
>
> For this, next-error-find-buffer-function should be set to
> #'next-error-buffer-on-selected-frame.

Yes, and in this case you can see the clarity and predictability of
this option: when the *Occur* buffer is visible on the selected frame,
next-error will navigate the occur results as the user will expect.
Hiding the window with the *Occur* buffer will switch navigation
to Flymake warnings in the current buffer.  This is what can be called
WYSIWYG.




Severity set to 'wishlist' from 'minor' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 12 Dec 2022 08:51:02 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 281 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.