Mercurial > hg > xemacs-beta
diff lisp/prim/buffer.el @ 4:b82b59fe008d r19-15b3
Import from CVS: tag r19-15b3
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:46:56 +0200 |
parents | 376386a54a3c |
children | 0293115a14e9 |
line wrap: on
line diff
--- a/lisp/prim/buffer.el Mon Aug 13 08:46:35 2007 +0200 +++ b/lisp/prim/buffer.el Mon Aug 13 08:46:56 2007 +0200 @@ -65,12 +65,16 @@ If optional second arg NOT-THIS-WINDOW-P is non-nil, insist on finding another window even if BUFNAME is already visible in the selected window. If optional third arg is non-nil, it is the frame to pop to this -buffer on." +buffer on. +If `focus-follows-mouse' is non-nil, keyboard focus is left unchanged." ;; #ifdef I18N3 ;; #### Doc string should indicate that the buffer name will get ;; translated. ;; #endif - (let (buf window frame) + ;; This is twisted. It is evil to throw the keyboard focus around + ;; willy-nilly if the user wants focus-follows-mouse. + (let ((oldbuf (current-buffer)) + buf window frame) (if (null bufname) (setq buf (other-buffer (current-buffer))) (setq buf (get-buffer bufname)) @@ -83,9 +87,15 @@ (setq window (display-buffer buf not-this-window-p on-frame)) (setq frame (window-frame window)) ;; if the display-buffer hook decided to show this buffer in another - ;; frame, then select that frame. - (if (not (eq frame (selected-frame))) + ;; frame, then select that frame, (unless obeying focus-follows-mouse -sb). + (if (and (not focus-follows-mouse) + (not (eq frame (selected-frame)))) (select-frame frame)) (record-buffer buf) - (select-window window) + (if (and focus-follows-mouse + on-frame + (not (eq on-frame (selected-frame)))) + (set-buffer oldbuf) + ;; select-window will modify the internal keyboard focus of XEmacs + (select-window window)) buf))