Commit 4dddd07f authored by Stephen Eglen's avatar Stephen Eglen
Browse files

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.
parent 00498bfc
2003-11-25 Stephen Eglen <stephen@gnu.org>
* iswitchb.el (iswitchb-read-buffer,iswitchb-exit-minibuffer):
iswitchb-exit is set to 'usefirst when user selects buffer at head
of list using RET. (Selecting buffers at the head of the list was
broken if the substring was also a complete buffername.)
2003-11-23 Kim F. Storm <storm@cua.dk> 2003-11-23 Kim F. Storm <storm@cua.dk>
* progmodes/compile.el (grep-command, grep-use-null-device) * progmodes/compile.el (grep-command, grep-use-null-device)
......
...@@ -610,7 +610,8 @@ If REQUIRE-MATCH is non-nil, an existing-buffer must be selected." ...@@ -610,7 +610,8 @@ If REQUIRE-MATCH is non-nil, an existing-buffer must be selected."
nil ;require-match [handled elsewhere] nil ;require-match [handled elsewhere]
nil ;initial-contents nil ;initial-contents
'iswitchb-history))) '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. ;; This happens for example if the buffer was chosen with the mouse.
(setq iswitchb-matches (list iswitchb-final-text))) (setq iswitchb-matches (list iswitchb-final-text)))
...@@ -712,7 +713,9 @@ The result is stored in `iswitchb-common-match-string'." ...@@ -712,7 +713,9 @@ The result is stored in `iswitchb-common-match-string'."
(interactive) (interactive)
(if (or (not iswitchb-require-match) (if (or (not iswitchb-require-match)
(iswitchb-existing-buffer-p)) (iswitchb-existing-buffer-p))
(throw 'exit nil))) (progn
(setq iswitchb-exit 'usefirst)
(throw 'exit nil))))
(defun iswitchb-select-buffer-text () (defun iswitchb-select-buffer-text ()
"Select the buffer named by the prompt. "Select the buffer named by the prompt.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment