From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#40919: 27.0.91; next-error-select-buffer does not always behave as documented Date: Thu, 11 Jun 2020 02:05:39 +0300 Organization: LINKOV.NET Message-ID: <87a71amsho.fsf@mail.linkov.net> References: <53913bd9-2bdc-0f70-f7b4-744283e0512f@ieee.org> <87d07rmb6j.fsf@mail.linkov.net> <87zhau5bfw.fsf@mail.linkov.net> <66f63b16-307a-919c-1d25-60ff63f92ae6@ieee.org> <87bln8u3xq.fsf@mail.linkov.net> <851cd382-4b2e-447a-2212-919c8a4ce908@ieee.org> <87d07lykkd.fsf@mail.linkov.net> <83bln5rbah.fsf@gnu.org> <87zhaozlvo.fsf@mail.linkov.net> <87v9kr8t1s.fsf@mail.linkov.net> <87zh9yuw5o.fsf@mail.linkov.net> <251b7e0d-ef94-e438-4023-a6513b611725@yandex.ru> <87lfl6tojw.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="84611"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 40919@debbugs.gnu.org, tspiteri@ieee.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 11 01:21:44 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 1jjA2R-000LyO-Jv for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Jun 2020 01:21:43 +0200 Original-Received: from localhost ([::1]:54340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjA2Q-0001Mp-KY for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jun 2020 19:21:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjA1m-0000ke-Hd for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2020 19:21:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52293) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jjA1m-00060E-6f for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2020 19:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jjA1m-00010w-2a for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2020 19:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jun 2020 23:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40919 X-GNU-PR-Package: emacs Original-Received: via spool by 40919-submit@debbugs.gnu.org id=B40919.15918312473826 (code B ref 40919); Wed, 10 Jun 2020 23:21:02 +0000 Original-Received: (at 40919) by debbugs.gnu.org; 10 Jun 2020 23:20:47 +0000 Original-Received: from localhost ([127.0.0.1]:35599 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjA1T-0000zX-Gn for submit@debbugs.gnu.org; Wed, 10 Jun 2020 19:20:46 -0400 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:39035) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jjA1R-0000z6-AT for 40919@debbugs.gnu.org; Wed, 10 Jun 2020 19:20:41 -0400 X-Originating-IP: 91.129.108.6 Original-Received: from mail.gandi.net (m91-129-108-6.cust.tele2.ee [91.129.108.6]) (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 5DBCCE0002; Wed, 10 Jun 2020 23:20:32 +0000 (UTC) In-Reply-To: (Dmitry Gutov's message of "Tue, 2 Jun 2020 02:04:39 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:181840 Archived-At: --=-=-= Content-Type: text/plain >> Tho I think in master next-error-find-buffer-function >> should support a list of functions, so the user could customize >> their order to arrange their priorities. Then they could be called >> with run-hook-with-args-until-success. > > I suppose. > > We should perhaps wait and see if people do customize that variable at > all. But the idea is solid. Actually, people already want to customize it to a list (at least, I know one such user :) So here is a patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=next-error-find-buffer-function-repeat.patch diff --git a/lisp/simple.el b/lisp/simple.el index 0fe8a1025c..646236879c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -199,7 +199,7 @@ next-error-buffer-p (and extra-test-inclusive (funcall extra-test-inclusive)))))) -(defcustom next-error-find-buffer-function #'ignore +(defcustom next-error-find-buffer-function '(ignore) "Function called to find a `next-error' capable buffer. This functions takes the same three arguments as the function `next-error-find-buffer', and should return the buffer to be @@ -208,12 +208,13 @@ next-error-find-buffer-function If the function returns nil, `next-error-find-buffer' will try to use the buffer it used previously, and failing that all other buffers." - :type '(choice (const :tag "No default" ignore) - (const :tag "Single next-error capable buffer on selected frame" - next-error-buffer-on-selected-frame) - (const :tag "Current buffer if next-error capable and outside navigation" - next-error-no-navigation-try-current) - (function :tag "Other function")) + :type '(repeat + (choice (const :tag "No default" ignore) + (const :tag "Single next-error capable buffer on selected frame" + next-error-buffer-on-selected-frame) + (const :tag "Current buffer if next-error capable and outside navigation" + next-error-no-navigation-try-current) + (function :tag "Other function"))) :group 'next-error :version "28.1") @@ -275,9 +276,13 @@ next-error-find-buffer that buffer is rejected." (or ;; 1. If a customizable function returns a buffer, use it. - (funcall next-error-find-buffer-function avoid-current - extra-test-inclusive - extra-test-exclusive) + (or (and (functionp next-error-find-buffer-function) + (funcall next-error-find-buffer-function avoid-current + extra-test-inclusive extra-test-exclusive)) + (and (listp next-error-find-buffer-function) + (run-hook-with-args-until-success + 'next-error-find-buffer-function avoid-current + extra-test-inclusive extra-test-exclusive))) ;; 2. If next-error-last-buffer is an acceptable buffer, use that. (if (and next-error-last-buffer (next-error-buffer-p next-error-last-buffer avoid-current --=-=-=--