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

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

Re: what is minibuffer-completion-confirm's purpose?


From: Kevin Rodgers
Subject: Re: what is minibuffer-completion-confirm's purpose?
Date: Thu, 20 May 2004 14:17:42 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Chris Green wrote:
> In XEmacs, I can set minibuffer-confirm-incomplete and that will
> prevent me from accepting a minibuffer completion that doesn't already
> exist without confirmation.
>
> For example, C-x b *Unknown* will prompt saying [no completions,
> confirm] if the buffer *Unknown* doesn't already exist or C-x f
> .bashtc will also say [no completions, confirm].'
>
> In Emacs 21.3.1 and current CVS,
>
> minibuffer-completion-confirm seems to provide that same kind of
> functionality by it's docstring.  However, setting it to t doesn't
> give me the desired behavior combined with emacs -q.  Is there another
> minibuffer customization I can perform to get the promping on unknown
> behavior?

Not really.  completing-read overrides minibuffer-completion-confirm's
ambient value, resetting it according to its REQUIRE-MATCH argument.
And many commands like switch-to-buffer (C-x b) and find-file (C-x C-f)
are defined using interactive codes that allow non-existent buffers and
files ("B" and "F"), which pass a nil REQUIRE-MATCH through read-buffer
and read-file-name to completing-read.

That being said, see these examples from lisp/emacs-lisp/advice.el:

;;(defadvice switch-to-buffer (before existing-buffers-only activate)
;;  "When called interactively switch to existing buffers only, unless
;;when called with a prefix argument."
;;  (interactive
;;   (list (read-buffer "Switch to buffer: " (other-buffer)
;;                      (null current-prefix-arg)))))
;;
;;(defadvice switch-to-buffer (around confirm-non-existing-buffers activate)
;;  "Switch to non-existing buffers only upon confirmation."
;;  (interactive "BSwitch to buffer: ")
;;  (if (or (get-buffer (ad-get-arg 0))
;;          (y-or-n-p (format "`%s' does not exist, create? " (ad-get-arg 0))))
;;      ad-do-it))
;;
;;(defadvice find-file (before existing-files-only activate)
;;  "Find existing files only"
;;  (interactive "fFind file: "))

--
Kevin Rodgers



reply via email to

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