From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: next-error use cases Date: Sun, 08 Apr 2018 00:47:42 +0300 Organization: LINKOV.NET Message-ID: <87zi2esn7l.fsf@mail.linkov.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1523138140 23871 195.159.176.226 (7 Apr 2018 21:55:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 7 Apr 2018 21:55:40 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 07 23:55:36 2018 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 1f4vo8-00066C-7m for ged-emacs-devel@m.gmane.org; Sat, 07 Apr 2018 23:55:36 +0200 Original-Received: from localhost ([::1]:56131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4vqD-0003zR-ME for ged-emacs-devel@m.gmane.org; Sat, 07 Apr 2018 17:57:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4vq6-0003ye-8A for emacs-devel@gnu.org; Sat, 07 Apr 2018 17:57:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4vq3-0008De-5B for emacs-devel@gnu.org; Sat, 07 Apr 2018 17:57:38 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:42356 helo=homiemail-a18.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f4vq2-0008Bd-UI for emacs-devel@gnu.org; Sat, 07 Apr 2018 17:57:35 -0400 Original-Received: from homiemail-a18.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a18.g.dreamhost.com (Postfix) with ESMTP id 69FEF258068 for ; Sat, 7 Apr 2018 14:57:33 -0700 (PDT) Original-Received: from localhost.linkov.net (m91-129-105-236.cust.tele2.ee [91.129.105.236]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a18.g.dreamhost.com (Postfix) with ESMTPSA id C1ED7258066 for ; Sat, 7 Apr 2018 14:57:32 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 69.163.253.7 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:224422 Archived-At: Several bug reports such as bug#20489 and bug#30674 revolve around the uncertainty caused by unclear requirements for the next-error framework. It would be helpful to identify possible scenarios to get a clearer picture of what it's supposed to do. The cornerstone of the whole feature is the function next-error-find-buffer that returns a next-error capable buffer that defines next-error-function to navigate to the next location. Most fallbacks in next-error-find-buffer are fine in case the first condition fails, but the main question is about the first condition itself: What is the best default behavior for it? What other useful options it should provide? What context should be used to select the right next-error-function buffer. There are several alternatives of what buffer with next-error-function should be selected after running next-error: 1. last next-error-function used anywhere globally Pros: context-free, thus easier to understand Cons: not WYSIWYG, i.e. in some cases produces unexpected results: for example, after switching to another next-error-function buffer will still continue the previous navigation from the hidden buffer with last used next-error-function 2. next-error-function found in the current buffer Cons: unexpected results when navigation visits another buffer with next-error-function, e.g. when a ChangeLog file is visited by next-error from the *grep* buffer, the next next-error should continue visiting grep hits, not ChangeLog entries. (But when a next-error navigation never visited a next-error-function buffer, then running `next-error' in a next-error-function buffer should use it unconditionally, e.g. switching to a *compilation* buffer and running next-error should use it.) 3. next-error-function that visited the current buffer, i.e. buffer-local value of next-error-last-buffer remembers the last used next-error-function buffer in each visited buffer, and uses it for the next next-error. Cons: unexpected results when the same buffer is visited in different windows from different next-error-function buffers 4. next-error-function that visited the buffer in the selected window Pros: window-based logic gives more expected results 5. buffer with next-error-function visible in one of adjacent windows on the same frame Pros: WYSIWYG Cons: ambiguous when there are more than one window with next-error-function on the frame What complicates matter more is that the value of next-error-function might come from the same buffer where navigation occurs, i.e. unlike these cases where next-error-function is defined in a special separate buffer: compilation-next-error-function xref--next-error-function occur-next-error change-log-next-error diff-next-error next-error-function can be defined in the same buffer, for example for: flymake-goto-next-error flyspell-goto-next-error where the list of locations comes from the same buffer where next-error navigates. So the question is how one buffer can provide many next-error functions by such different major/minor modes (flymake, flyspell) enabled in it at the same time?