# HG changeset patch # User Stephen Eglen # Date 1069771064 0 # Node ID 779a274d72ede79bddaf50df29a61b4f28385f15 # Parent f71ce92df3cbfb45257115c8fe12f237b3f825f8 iswitchb-read-buffer: check that iswitchb-exit is not 'usefirst (set when user presses RETURN to select buffer) before running: ;; This happens for example if the buffer was chosen with the mouse. (setq iswitchb-matches (list iswitchb-final-text))) iswitchb-exit-minibuffer: set iswitchb-exit to 'usefirst. These changes were made to fix the following bug reported by Markus Rost and John Wiegley: Evaluate: (progn (iswitchb-mode 1) (get-buffer-create "12") (get-buffer-create "1") (iswitchb-buffer)) You get prompted in the minibuffer. Type "1". The minibuffer shows iswitch 1{12,1} Hit RET. You find yourself in buffer "1" instead of "12", as you would expect from the documentation. This bug was introduced when iswitchb-read-buffer was updated to allow user to select items from the *Completions* buffer with the mouse. diff -r f71ce92df3cb -r 779a274d72ed lisp/iswitchb.el --- a/lisp/iswitchb.el Tue Nov 25 12:22:08 2003 +0000 +++ b/lisp/iswitchb.el Tue Nov 25 14:37:44 2003 +0000 @@ -610,7 +610,8 @@ nil ;require-match [handled elsewhere] nil ;initial-contents 'iswitchb-history))) - (if (get-buffer iswitchb-final-text) + (if (and (not (eq iswitchb-exit 'usefirst)) + (get-buffer iswitchb-final-text)) ;; This happens for example if the buffer was chosen with the mouse. (setq iswitchb-matches (list iswitchb-final-text))) @@ -712,7 +713,9 @@ (interactive) (if (or (not iswitchb-require-match) (iswitchb-existing-buffer-p)) - (throw 'exit nil))) + (progn + (setq iswitchb-exit 'usefirst) + (throw 'exit nil)))) (defun iswitchb-select-buffer-text () "Select the buffer named by the prompt.