comparison lisp/prim/buffer.el @ 72:b9518feda344 r20-0b31

Import from CVS: tag r20-0b31
author cvs
date Mon, 13 Aug 2007 09:03:46 +0200
parents 131b0175ea99
children
comparison
equal deleted inserted replaced
71:bae944334fa4 72:b9518feda344
64 If BUFNAME is nil, then some other buffer is chosen. 64 If BUFNAME is nil, then some other buffer is chosen.
65 If `pop-up-windows' is non-nil, windows can be split to do this. 65 If `pop-up-windows' is non-nil, windows can be split to do this.
66 If optional second arg NOT-THIS-WINDOW-P is non-nil, insist on finding 66 If optional second arg NOT-THIS-WINDOW-P is non-nil, insist on finding
67 another window even if BUFNAME is already visible in the selected window. 67 another window even if BUFNAME is already visible in the selected window.
68 If optional third arg is non-nil, it is the frame to pop to this 68 If optional third arg is non-nil, it is the frame to pop to this
69 buffer on." 69 buffer on.
70 If `focus-follows-mouse' is non-nil, keyboard focus is left unchanged."
70 ;; #ifdef I18N3 71 ;; #ifdef I18N3
71 ;; #### Doc string should indicate that the buffer name will get 72 ;; #### Doc string should indicate that the buffer name will get
72 ;; translated. 73 ;; translated.
73 ;; #endif 74 ;; #endif
74 (let (buf window frame) 75 ;; This is twisted. It is evil to throw the keyboard focus around
76 ;; willy-nilly if the user wants focus-follows-mouse.
77 (let ((oldbuf (current-buffer))
78 buf window frame)
75 (if (null bufname) 79 (if (null bufname)
76 (setq buf (other-buffer (current-buffer))) 80 (setq buf (other-buffer (current-buffer)))
77 (setq buf (get-buffer bufname)) 81 (setq buf (get-buffer bufname))
78 (if (null buf) 82 (if (null buf)
79 (progn 83 (progn
82 (push-window-configuration) 86 (push-window-configuration)
83 (set-buffer buf) 87 (set-buffer buf)
84 (setq window (display-buffer buf not-this-window-p on-frame)) 88 (setq window (display-buffer buf not-this-window-p on-frame))
85 (setq frame (window-frame window)) 89 (setq frame (window-frame window))
86 ;; if the display-buffer hook decided to show this buffer in another 90 ;; if the display-buffer hook decided to show this buffer in another
87 ;; frame, then select that frame. 91 ;; frame, then select that frame, (unless obeying focus-follows-mouse -sb).
88 (if (not (eq frame (selected-frame))) 92 (if (and (not focus-follows-mouse)
93 (not (eq frame (selected-frame))))
89 (select-frame frame)) 94 (select-frame frame))
90 (record-buffer buf) 95 (record-buffer buf)
91 (select-window window) 96 (if (and focus-follows-mouse
97 on-frame
98 (not (eq on-frame (selected-frame))))
99 (set-buffer oldbuf)
100 ;; select-window will modify the internal keyboard focus of XEmacs
101 (select-window window))
92 buf)) 102 buf))