summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2008-11-24 19:14:05 +0000
committerChong Yidong <cyd@stupidchicken.com>2008-11-24 19:14:05 +0000
commitbec1e8a50edcee3fdafc0925c9a3a3f206f507ce (patch)
treeba2f9a1555b93282e956cb4668f5d1755a2ffef7 /lisp/minibuffer.el
parent4a977e2030bfd7061ff69ea6ec402525f37a62f2 (diff)
downloademacs-bec1e8a50edcee3fdafc0925c9a3a3f206f507ce.tar.gz
(minibuffer-complete-and-exit): Change `confirm-only' value of
minibuffer-completion-confirm to `confirm', and handle a `confirm-after-completion' value.
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el30
1 files changed, 22 insertions, 8 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index eb78bba80fc..d16d0362a36 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -543,12 +543,18 @@ Repeated uses step through the possible completions."
(setq completion-all-sorted-completions (cdr all)))))
(defun minibuffer-complete-and-exit ()
- "If the minibuffer contents is a valid completion then exit.
-Otherwise try to complete it. If completion leads to a valid completion,
-a repetition of this command will exit.
-If `minibuffer-completion-confirm' is equal to `confirm', then do not
-try to complete, but simply ask for confirmation and accept any
-input if confirmed."
+ "Exit if the minibuffer contains a valid completion.
+Otherwise, try to complete the minibuffer contents. If
+completion leads to a valid completion, a repetition of this
+command will exit.
+
+If `minibuffer-completion-confirm' is `confirm', do not try to
+ complete; instead, ask for confirmation and accept any input if
+ confirmed.
+If `minibuffer-completion-confirm' is `confirm-after-completion',
+ do not try to complete; instead, ask for confirmation if the
+ preceding minibuffer command was `minibuffer-complete', and
+ accept the input otherwise."
(interactive)
(let ((beg (field-beginning))
(end (field-end)))
@@ -578,14 +584,22 @@ input if confirmed."
(delete-region beg end))))
(exit-minibuffer))
- ((eq minibuffer-completion-confirm 'confirm-only)
+ ((eq minibuffer-completion-confirm 'confirm)
;; The user is permitted to exit with an input that's rejected
- ;; by test-completion, but at the condition to confirm her choice.
+ ;; by test-completion, after confirming her choice.
(if (eq last-command this-command)
(exit-minibuffer)
(minibuffer-message "Confirm")
nil))
+ ((eq minibuffer-completion-confirm 'confirm-after-completion)
+ ;; Similar to the above, but only if trying to exit immediately
+ ;; after typing TAB (this catches most minibuffer typos).
+ (if (eq last-command 'minibuffer-complete)
+ (progn (minibuffer-message "Confirm")
+ nil)
+ (exit-minibuffer)))
+
(t
;; Call do-completion, but ignore errors.
(case (condition-case nil