unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 20489@debbugs.gnu.org
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	[thread overview]
Message-ID: <87r2pc7w60.fsf@mail.linkov.net> (raw)
In-Reply-To: <jwvvaeqxasr.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Wed, 21 Feb 2018 17:04:49 -0500")

>> +(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	other threads:[~2018-02-22 21:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180221213025.27066.69339@vcs0.savannah.gnu.org>
     [not found] ` <20180221213027.372932052F@vcs0.savannah.gnu.org>
     [not found]   ` <jwvvaeqxasr.fsf-monnier+emacsdiffs@gnu.org>
2018-02-22 21:38     ` Juri Linkov [this message]
2018-02-23 14:36       ` bug#20489: [Emacs-diffs] master d48e07a: * lisp/simple.el (next-error-find-buffer-function): New defcustom Stefan Monnier
2018-02-24 21:34         ` Juri Linkov
2018-02-25 13:19           ` Stefan Monnier
2018-02-25 20:40             ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r2pc7w60.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=20489@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).