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: Mon, 25 Jan 2016 23:55:10 +0200 Organization: LINKOV.NET Message-ID: <87zivtqq81.fsf@mail.linkov.net> References: <86wq0q602w.fsf@yandex.ru> <87oacaiszd.fsf@mail.linkov.net> <56A5BF79.909@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1453759165 29616 80.91.229.3 (25 Jan 2016 21:59:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Jan 2016 21:59:25 +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 Mon Jan 25 22:59:14 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 1aNpAF-00081V-Sq for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jan 2016 22:59:12 +0100 Original-Received: from localhost ([::1]:40958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNpAE-0007La-Tq for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jan 2016 16:59:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNpAB-0007LR-4J for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2016 16:59:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNpA6-0002uM-2r for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2016 16:59:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNpA5-0002uI-V9 for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2016 16:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aNpA5-0004dU-Q2 for bug-gnu-emacs@gnu.org; Mon, 25 Jan 2016 16:59:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Jan 2016 21:59:01 +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.145375913817810 (code B ref 20489); Mon, 25 Jan 2016 21:59:01 +0000 Original-Received: (at 20489) by debbugs.gnu.org; 25 Jan 2016 21:58:58 +0000 Original-Received: from localhost ([127.0.0.1]:36435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aNpA2-0004dB-H3 for submit@debbugs.gnu.org; Mon, 25 Jan 2016 16:58:58 -0500 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:40355 helo=homiemail-a22.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aNpA0-0004d3-Gc for 20489@debbugs.gnu.org; Mon, 25 Jan 2016 16:58:57 -0500 Original-Received: from homiemail-a22.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTP id 326B41A8069; Mon, 25 Jan 2016 13:58:53 -0800 (PST) Original-Received: from localhost.linkov.net (82.131.9.206.cable.starman.ee [82.131.9.206]) (Authenticated sender: jurta@jurta.org) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTPA id 59F2A1A8063; Mon, 25 Jan 2016 13:58:52 -0800 (PST) In-Reply-To: <56A5BF79.909@yandex.ru> (Dmitry Gutov's message of "Mon, 25 Jan 2016 09:23:53 +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:111967 Archived-At: >> The link to the discussion is here: >> http://lists.gnu.org/archive/html/emacs-devel/2004-05/msg00614.html >> where you can see the case that we need to support. > > In this scenario, it seems like you could have benefited from > next-error-last-buffer value being frame-local instead (maybe implemented > as a frame parameter?). A frame might contain more pairs of navigational/target windows, e.g. a window with *grep* output, and a file buffer visited from *grep*; a window with *Occur*, and another place in the same file buffer but visited from *Occur*, etc. So frame-local is not of help here, whereas window-local is, provided a navigational window (like *grep*/*compilation*) always displays target buffers in another dedicated window. As I see this is not what xref currently does: navigating in it jumps between many different windows that is very inconvenient, but this can be easily fixed to work the sane way as *grep* or *compilation* already works. >> Now that we have window-local variables, it's possible to support >> this case in a proper way. Instead of checking if a buffer visible >> in the current frame, we should check the window-local value of >> next-error-last-buffer. Thus invoking next-error in the window >> with the source buffer will continue navigation using the right value >> of next-error-last-buffer that navigated to its previous occurrence. > > How do linting minor modes (like Flycheck or Flymake) fit into this? Does Flycheck or Flymake display a navigation window with a list of results? If not, then this is a new case that we need to support as well. > 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 highlighed > by Flycheck. So I want to use the current buffer's next-error-function 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 buffer, > 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? > Basically, I want to have two at least somewhat guessable sequences of > actions that would let the user choose which buffer to use for its > next-error-function. > > As discussed in this issue, the best way to do that seems to require: > > - 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 still > 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? > - A command (or several) to switch between the plausible candidates for > 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. > - Ignore next-error-last-buffer's visibility. Or make it frame-local, to > account for your scenario as well (but that would bring extra complexity: > some people use use frames like almost separate applications, and other can > use frames instead of windows, and display them side-by-side). Buffers are displayed in windows, so better to bind them to windows. > WDYT? I remember the original idea was to always continue the same navigation that displayed a given target buffer/window, so switching to another navigation in the same window could be achieved by explicitly navigating to another result from another navigation, e.g. when current navigation was from *compilation* then switching to *grep* buffer and typing M-n for the next grep hit in the same file buffer.