Mercurial > emacs
comparison lisp/iswitchb.el @ 53161:779a274d72ed
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.
author | Stephen Eglen <stephen@gnu.org> |
---|---|
date | Tue, 25 Nov 2003 14:37:44 +0000 |
parents | 695cf19ef79e |
children | dd6aac780c4b |
comparison
equal
deleted
inserted
replaced
53160:f71ce92df3cb | 53161:779a274d72ed |
---|---|
608 '(("dummy" . 1)) ;table | 608 '(("dummy" . 1)) ;table |
609 nil ;predicate | 609 nil ;predicate |
610 nil ;require-match [handled elsewhere] | 610 nil ;require-match [handled elsewhere] |
611 nil ;initial-contents | 611 nil ;initial-contents |
612 'iswitchb-history))) | 612 'iswitchb-history))) |
613 (if (get-buffer iswitchb-final-text) | 613 (if (and (not (eq iswitchb-exit 'usefirst)) |
614 (get-buffer iswitchb-final-text)) | |
614 ;; This happens for example if the buffer was chosen with the mouse. | 615 ;; This happens for example if the buffer was chosen with the mouse. |
615 (setq iswitchb-matches (list iswitchb-final-text))) | 616 (setq iswitchb-matches (list iswitchb-final-text))) |
616 | 617 |
617 ;; Handling the require-match must be done in a better way. | 618 ;; Handling the require-match must be done in a better way. |
618 (if (and require-match (not (iswitchb-existing-buffer-p))) | 619 (if (and require-match (not (iswitchb-existing-buffer-p))) |
710 (defun iswitchb-exit-minibuffer () | 711 (defun iswitchb-exit-minibuffer () |
711 "Exit minibuffer, but make sure we have a match if one is needed." | 712 "Exit minibuffer, but make sure we have a match if one is needed." |
712 (interactive) | 713 (interactive) |
713 (if (or (not iswitchb-require-match) | 714 (if (or (not iswitchb-require-match) |
714 (iswitchb-existing-buffer-p)) | 715 (iswitchb-existing-buffer-p)) |
715 (throw 'exit nil))) | 716 (progn |
717 (setq iswitchb-exit 'usefirst) | |
718 (throw 'exit nil)))) | |
716 | 719 |
717 (defun iswitchb-select-buffer-text () | 720 (defun iswitchb-select-buffer-text () |
718 "Select the buffer named by the prompt. | 721 "Select the buffer named by the prompt. |
719 If no buffer exactly matching the prompt exists, maybe create a new one." | 722 If no buffer exactly matching the prompt exists, maybe create a new one." |
720 (interactive) | 723 (interactive) |