# HG changeset patch # User Miles Bader # Date 1227982035 0 # Node ID f42890851326cf708265c3e1df1ac94a9d7def7d # Parent 40a45069dd91a0f10eb0874fdc98bab4b855764e Add and use minibuffer-confirm-exit-commands variable Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1483 diff -r 40a45069dd91 -r f42890851326 lisp/ChangeLog --- a/lisp/ChangeLog Sat Nov 29 17:06:11 2008 +0000 +++ b/lisp/ChangeLog Sat Nov 29 18:07:15 2008 +0000 @@ -1,3 +1,8 @@ +2008-11-29 Miles Bader + + * minibuffer.el (minibuffer-confirm-exit-commands): New variable. + (minibuffer-complete-and-exit): Use it. + 2008-11-29 Chong Yidong * term/x-win.el (x-gtk-stock-cache): New hash table. diff -r 40a45069dd91 -r f42890851326 lisp/minibuffer.el --- a/lisp/minibuffer.el Sat Nov 29 17:06:11 2008 +0000 +++ b/lisp/minibuffer.el Sat Nov 29 18:07:15 2008 +0000 @@ -542,6 +542,11 @@ ;; through the previous possible completions. (setq completion-all-sorted-completions (cdr all))))) +(defvar minibuffer-confirm-exit-commands + '(minibuffer-complete minibuffer-complete-word) + "A list of commands which cause an immediately following +`minibuffer-complete-and-exit' to ask for extra confirmation.") + (defun minibuffer-complete-and-exit () "Exit if the minibuffer contains a valid completion. Otherwise, try to complete the minibuffer contents. If @@ -595,7 +600,7 @@ ((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) + (if (memq last-command minibuffer-confirm-exit-commands) (progn (minibuffer-message "Confirm") nil) (exit-minibuffer)))