bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20489: [Emacs-diffs] master d48e07a: * lisp/simple.el (next-error-fi


From: Juri Linkov
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> +(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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]