From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#20489: [Emacs-diffs] master d48e07a: * lisp/simple.el (next-error-find-buffer-function): New defcustom. Date: Thu, 22 Feb 2018 23:38:23 +0200 Organization: LINKOV.NET Message-ID: <87r2pc7w60.fsf@mail.linkov.net> References: <20180221213025.27066.69339@vcs0.savannah.gnu.org> <20180221213027.372932052F@vcs0.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1519335912 3286 195.159.176.226 (22 Feb 2018 21:45:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 22 Feb 2018 21:45:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 20489@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 22 22:45:08 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1eoyfr-0000Sr-M4 for geb-bug-gnu-emacs@m.gmane.org; Thu, 22 Feb 2018 22:45:07 +0100 Original-Received: from localhost ([::1]:41018 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoyht-0006pb-PY for geb-bug-gnu-emacs@m.gmane.org; Thu, 22 Feb 2018 16:47:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoyhl-0006pQ-18 for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2018 16:47:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoyhh-0003eL-US for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2018 16:47:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49014) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eoyhh-0003e1-R4 for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2018 16:47:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eoyhh-0001pI-Hq for bug-gnu-emacs@gnu.org; Thu, 22 Feb 2018 16:47: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: Thu, 22 Feb 2018 21:47: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.15193359986984 (code B ref 20489); Thu, 22 Feb 2018 21:47:01 +0000 Original-Received: (at 20489) by debbugs.gnu.org; 22 Feb 2018 21:46:38 +0000 Original-Received: from localhost ([127.0.0.1]:56911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoyhK-0001oZ-DH for submit@debbugs.gnu.org; Thu, 22 Feb 2018 16:46:38 -0500 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:37979 helo=homiemail-a15.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoyhI-0001oO-Bt for 20489@debbugs.gnu.org; Thu, 22 Feb 2018 16:46:37 -0500 Original-Received: from homiemail-a15.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a15.g.dreamhost.com (Postfix) with ESMTP id 3683976C06B; Thu, 22 Feb 2018 13:46:35 -0800 (PST) Original-Received: from localhost.linkov.net (m91-129-98-215.cust.tele2.ee [91.129.98.215]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a15.g.dreamhost.com (Postfix) with ESMTPSA id 5D64F76C069; Thu, 22 Feb 2018 13:46:34 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Wed, 21 Feb 2018 17:04:49 -0500") 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" Xref: news.gmane.org gmane.emacs.bugs:143606 Archived-At: >> +(defcustom next-error-find-buffer-function nil > > Why make it a defcustom rather than a defvar? I changed it to defvar in the following patch. >> + (when next-error-find-buffer-function >> + (funcall next-error-find-buffer-function avoid-current >> + extra-test-inclusive >> + extra-test-exclusive)) > > Could you arrange for the default value of this new *-function var not > to be nil so we can modify it with add-function? Then I guess the default function should return nil. Here is a new patch: diff --git a/lisp/simple.el b/lisp/simple.el index 2101cfe..5413b5a 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -170,14 +170,12 @@ next-error-buffer-p (and extra-test-inclusive (funcall extra-test-inclusive)))))) -(defcustom next-error-find-buffer-function nil - "Function called to find a `next-error' capable buffer." - :type '(choice (const :tag "Single next-error capable buffer on selected frame" - next-error-buffer-on-selected-frame) - (const :tag "No default" nil) - (function :tag "Other function")) - :group 'next-error - :version "27.1") +(defvar next-error-find-buffer-function 'next-error-find-buffer-function-default + "Function to find a `next-error' capable buffer.") + +(defun next-error-find-buffer-function-default (&optional avoid-current + extra-test-inclusive + extra-test-exclusive)) (defun next-error-buffer-on-selected-frame (&optional avoid-current extra-test-inclusive @@ -212,10 +210,9 @@ next-error-find-buffer that buffer is rejected." (or ;; 1. If a customizable function returns a buffer, use it. - (when next-error-find-buffer-function - (funcall next-error-find-buffer-function avoid-current - extra-test-inclusive - extra-test-exclusive)) + (funcall 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