GNU bug report logs - #20489
25.0.50; next-error-find-buffer chooses non-current buffer without good reason

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Sat, 2 May 2015 23:19:01 UTC

Severity: normal

Found in version 25.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #133 received at 20489 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 20489 <at> debbugs.gnu.org
Subject: Re: [Emacs-diffs] master d48e07a: * lisp/simple.el
 (next-error-find-buffer-function): New defcustom.
Date: Thu, 22 Feb 2018 23:38:23 +0200
>> +(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




This bug report was last modified 7 years and 72 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.