aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2001-12-10 20:41:18 +0000
committerRichard M. Stallman2001-12-10 20:41:18 +0000
commit4d8ae757b2662eca9e0d49c3fb27e69fb85cab85 (patch)
tree433967d6e4c26f82349eca3585f3ef293ae525cc
parent6fa4074323ce8103b54bfa6828dde2830c97c72b (diff)
downloademacs-4d8ae757b2662eca9e0d49c3fb27e69fb85cab85.tar.gz
emacs-4d8ae757b2662eca9e0d49c3fb27e69fb85cab85.zip
(iswitchb-visit-buffer): Use `select-frame-set-input-focus'.
It is needed when window manager uses "click to focus" policy.
-rw-r--r--lisp/iswitchb.el67
1 files changed, 48 insertions, 19 deletions
diff --git a/lisp/iswitchb.el b/lisp/iswitchb.el
index 5ec032adb98..aece0d2dea0 100644
--- a/lisp/iswitchb.el
+++ b/lisp/iswitchb.el
@@ -49,9 +49,9 @@
49 49
50;;; Example 50;;; Example
51 51
52;;If I have two buffers called "123456" and "123", with "123456" the 52;; If I have two buffers called "123456" and "123", with "123456" the
53;;most recent, when I use iswitchb, I first of all get presented with 53;; most recent, when I use iswitchb, I first of all get presented with
54;;the list of all the buffers 54;; the list of all the buffers
55;; 55;;
56;; iswitch {123456,123} 56;; iswitch {123456,123}
57;; 57;;
@@ -73,12 +73,12 @@
73;; wanted the second in the list, I could press C-s to move it to the 73;; wanted the second in the list, I could press C-s to move it to the
74;; top of the list and then RET to select it. 74;; top of the list and then RET to select it.
75;; 75;;
76;;However, If I type 4, I only have one match left: 76;; However, if I type 4, I only have one match left:
77;; iswitch 234[123456] [Matched] 77;; iswitch 234[123456] [Matched]
78;; 78;;
79;;Since there is only one matching buffer left, it is given in [] and we 79;; Since there is only one matching buffer left, it is given in [] and we
80;;see the text [Matched] afterwards. I can now press TAB or RET to go 80;; see the text [Matched] afterwards. I can now press TAB or RET to go
81;;to that buffer. 81;; to that buffer.
82;; 82;;
83;; If however, I now type "a": 83;; If however, I now type "a":
84;; iswitch 234a [No match] 84;; iswitch 234a [No match]
@@ -103,9 +103,8 @@
103;; If you find that the file you are after is not in a buffer, you can 103;; If you find that the file you are after is not in a buffer, you can
104;; press C-x C-f to immediately drop into find-file. 104;; press C-x C-f to immediately drop into find-file.
105 105
106;; 106;; See the doc string of iswitchb for full keybindings and features.
107;; See the doc string of iswitchb for full keybindings and features. 107;; (describe-function 'iswitchb)
108;; (describe-function 'iswitchb)
109 108
110;; Case matching: The case of strings when matching can be ignored or 109;; Case matching: The case of strings when matching can be ignored or
111;; used depending on the value of iswitchb-case (default is the same 110;; used depending on the value of iswitchb-case (default is the same
@@ -176,11 +175,42 @@
176;; for the normal buffer selection routine `read-buffer'. To use 175;; for the normal buffer selection routine `read-buffer'. To use
177;; iswitch for all buffer selections in Emacs, add: 176;; iswitch for all buffer selections in Emacs, add:
178;; (setq read-buffer-function 'iswitchb-read-buffer) 177;; (setq read-buffer-function 'iswitchb-read-buffer)
179;; (This variable should be present in Emacs 20.3+) 178;; (This variable was introduced in Emacs 20.3.)
180;; XEmacs users can get the same behaviour by doing: 179;; XEmacs users can get the same behaviour by doing:
181;; (defalias 'read-buffer 'iswitchb-read-buffer) 180;; (defalias 'read-buffer 'iswitchb-read-buffer)
182;; since `read-buffer' is defined in lisp. 181;; since `read-buffer' is defined in lisp.
183 182
183;; Using iswitchb for other completion tasks.
184
185;; Kin Cho (kin@neoscale.com sent the following suggestion to use
186;; iswitchb for other completion tasks.
187;;
188;; (defun my-icompleting-read (prompt choices)
189;; "Use iswitch as a completing-read replacement to choose from
190;; choices. PROMPT is a string to prompt with. CHOICES is a list of
191;; strings to choose from."
192;; (let ((iswitchb-make-buflist-hook
193;; (lambda ()
194;; (setq iswitchb-temp-buflist choices))))
195;; (iswitchb-read-buffer prompt)))
196;;
197;; example:
198;; (my-icompleting-read "Which fruit? " '
199;; ("apple" "pineapple" "pear" "bananas" "oranges") )
200
201;; Other lisp packages extend iswitchb behaviour to other tasks. See
202;; ido.el (by Kim Storm) and mcomplete.el (Yuji Minejima).
203
204;; Window managers: Switching frames/focus follows mouse; Sawfish.
205
206;; If you switch to a buffer that is visible in another frame,
207;; iswitchb can switch focus to that frame. If your window manager
208;; uses "click to focus" policy for window selection, you should also
209;; set focus-follows-mouse to nil.
210
211;; iswitch functionality has also been implemented for switching
212;; between windows in the Sawfish window manager.
213
184;; Regexp matching 214;; Regexp matching
185 215
186;; There is limited provision for regexp matching within iswitchb, 216;; There is limited provision for regexp matching within iswitchb,
@@ -967,13 +997,12 @@ Return the modified list with the last element prepended to it."
967 (or (eq iswitchb-method 'always-frame) 997 (or (eq iswitchb-method 'always-frame)
968 (y-or-n-p "Jump to frame? "))) 998 (y-or-n-p "Jump to frame? ")))
969 (setq newframe (window-frame win)) 999 (setq newframe (window-frame win))
970 (raise-frame newframe) 1000 (if (not iswitchb-xemacs)
971 (select-frame newframe) 1001 (select-frame-set-input-focus newframe)
972 (select-window win) 1002 (raise-frame newframe)
973 (if (not iswitchb-xemacs) 1003 (select-frame newframe)
974 ;; reposition mouse to make frame active. not needed in XEmacs 1004 )
975 ;; This line came from the other-frame defun in Emacs. 1005 (select-window win))
976 (set-mouse-position (selected-frame) (1- (frame-width)) 0)))
977 (t 1006 (t
978 ;; No buffer in other frames... 1007 ;; No buffer in other frames...
979 (switch-to-buffer buffer) 1008 (switch-to-buffer buffer)
@@ -989,7 +1018,7 @@ Return the modified list with the last element prepended to it."
989 (progn 1018 (progn
990 (switch-to-buffer-other-frame buffer) 1019 (switch-to-buffer-other-frame buffer)
991 (if (not iswitchb-xemacs) 1020 (if (not iswitchb-xemacs)
992 (set-mouse-position (selected-frame) (1- (frame-width)) 0)) 1021 (select-frame-set-input-focus (selected-frame)))
993 ))))) 1022 )))))
994 1023
995(defun iswitchb-possible-new-buffer (buf) 1024(defun iswitchb-possible-new-buffer (buf)