From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#20489: 25.0.50; next-error-find-buffer chooses non-current buffer without good reason Date: Wed, 27 Jan 2016 02:57:30 +0200 Organization: LINKOV.NET Message-ID: <87y4bbol9h.fsf@mail.linkov.net> References: <86wq0q602w.fsf@yandex.ru> <87oacaiszd.fsf@mail.linkov.net> <56A5BF79.909@yandex.ru> <87zivtqq81.fsf@mail.linkov.net> <56A6B171.7080504@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1453858888 13437 80.91.229.3 (27 Jan 2016 01:41:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jan 2016 01:41:28 +0000 (UTC) Cc: 20489@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 27 02:41:13 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aOF6e-00029i-V2 for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Jan 2016 02:41:13 +0100 Original-Received: from localhost ([::1]:47724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOF6e-0000AV-5u for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Jan 2016 20:41:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOF6a-0000AK-5k for bug-gnu-emacs@gnu.org; Tue, 26 Jan 2016 20:41:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOF6V-0007h3-05 for bug-gnu-emacs@gnu.org; Tue, 26 Jan 2016 20:41:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOF6U-0007gs-SG for bug-gnu-emacs@gnu.org; Tue, 26 Jan 2016 20:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aOF6U-0007xv-Gr for bug-gnu-emacs@gnu.org; Tue, 26 Jan 2016 20:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Jan 2016 01:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20489 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20489-submit@debbugs.gnu.org id=B20489.145385884430589 (code B ref 20489); Wed, 27 Jan 2016 01:41:02 +0000 Original-Received: (at 20489) by debbugs.gnu.org; 27 Jan 2016 01:40:44 +0000 Original-Received: from localhost ([127.0.0.1]:37992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aOF6C-0007xI-Fu for submit@debbugs.gnu.org; Tue, 26 Jan 2016 20:40:44 -0500 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:56158 helo=homiemail-a13.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aOF6A-0007x8-RY for 20489@debbugs.gnu.org; Tue, 26 Jan 2016 20:40:43 -0500 Original-Received: from homiemail-a13.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a13.g.dreamhost.com (Postfix) with ESMTP id D1ACB334075; Tue, 26 Jan 2016 17:40:41 -0800 (PST) Original-Received: from localhost.linkov.net (82.131.23.111.cable.starman.ee [82.131.23.111]) (Authenticated sender: jurta@jurta.org) by homiemail-a13.g.dreamhost.com (Postfix) with ESMTPA id 10A32334072; Tue, 26 Jan 2016 17:40:40 -0800 (PST) In-Reply-To: <56A6B171.7080504@yandex.ru> (Dmitry Gutov's message of "Tue, 26 Jan 2016 02:36:17 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) 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: 208.118.235.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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:112021 Archived-At: > How does it really help? You've navigated from *grep*, to that buffer A= , > then did that from *compilation*, and then you can't continue jumping t= o > next *grep* occurrences from that buffer. I suppose that navigation from every navigational window displays its tar= gets in own dedicated window that will be associated with its =E2=80=9Cparent=E2= =80=9D window. So e.g. after navigating from *grep* to window A, and from *compilation* to window B, next-error invoked from windows A or B will continue the right navigation. > We can fix xref, but not every next-error-function uses the same window= , > and that's not codified in this variable's docstring. change-log-next-e= rror > doesn't. If some next-error-function doesn't use the same window, still there is no problem because its displayed window will continue the last navigation visited in that window. >>> Suppose I called M-x compile (or, better yet, M-x grep), navigated to= some >>> file buffer from it and then see that it has some linter errors highl= ighed >>> by Flycheck. So I want to use the current buffer's next-error-functio= n now, >>> and jump between linter warnings using next/previous-error. How do I = do >>> that? IIU your plan correctly, the current window-local >>> next-error-last-buffer value will continue pointing at the Grep buffe= r, >>> even if I bury it. >> >> What if you have two navigations in the same buffer, and both are >> without a navigation window that you can't bury? > > I don't follow. The above was an attempt to point out an hole in your > plan. I'm not sure you can refute that with a "what if" counter-example= . This adds another problematic case to consider, but we could avoid it by always requiring creation of a navigation buffer, possibly hidden when necessary. (As for your point about a hole, I already addressed it below - that requires unburing a navigation buffer that you want switch t= o). >>> - Some indicator that a given buffer's next-error-function points to = other >>> buffer (then, if you're in a different buffer, that other buffer is s= till >>> relevant). Like a buffer-local variable called, for example, >>> next-error-function-nonlocal. >> >> Do you mean to bind a navigation buffer with navigated target buffers/= windows? > > I mean to ask compilation-mode (as well as other similar modes) to > (setq-local next-error-function-nonlocal t), in addition to setting > next-error-function and next-error-last-buffer. How this could help to point to other buffer? >>> - A command (or several) to switch between the plausible candidates f= or >>> next-error-last-buffer. Maybe just have a single command that uses >>> read-buffer with a predicate checking the aforementioned variable and= an >>> extra option that means "just use the current buffer". >> >> This would be too complicated to use. > > Why complicated? It would just be a way to choose the source of errors = to > follow. You'd also be able to do that by clicking on an error, or press= ing > RET, in the "nonlocal" navigation buffers. I think it would be more WYSIWYG first to switch to the navigation buffer= , and then to click on an error, or press RET. > The main point, however, which you might not agree with, is to make > next-error-last-buffer global. I prefer this precedence: 1. window-local next-error-last-buffer 2. buffer-local next-error-last-buffer 3. global next-error-last-buffer >>> - Ignore next-error-last-buffer's visibility. Or make it frame-local,= to >>> account for your scenario as well (but that would bring extra complex= ity: >>> some people use use frames like almost separate applications, and oth= er can >>> use frames instead of windows, and display them side-by-side). >> >> Buffers are displayed in windows, so better to bind them to windows. > > Making next-error-last-buffer window-local feels clunkier to me: there > would be no indication that a given window is following *Compilation*, = for > example. And up until now, next-error worked more or less in > a global fashion. Are you hinting that currently there is such indication in the form of navigation buffer's window displayed in the same frame (rule#1 in next-error-find-buffer)? I proposed window-local next-error-last-buffer only because you had some problems with this rule using in xref. >> I remember the original idea was to always continue the same navigatio= n >> that displayed a given target buffer/window, so switching to another >> navigation in the same window could be achieved by explicitly navigati= ng >> to another result from another navigation, e.g. when current navigatio= n >> was from *compilation* then switching to *grep* buffer and typing M-n >> for the next grep hit in the same file buffer. > > How will you "switch" to the next-error-function set locally by Flychec= k in > the current file-visiting buffer? By restarting Flycheck? > How will you switch between Grep and Compilation if they display a loca= tion > in the same buffer (and window)? Won't the desired navigation buffer ha= ve > to be visible? So you'd have to select some window, switch to that buff= er > in it, and then click or press RET on some error? Yes. > Using a command to switch between next-error-last-buffer candidates see= ms > much quicker. In case of Flycheck, there will be no next-error-last-buffer, no?