comparison lisp/prim/buffer.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 0293115a14e9
children b9518feda344
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ;; General Public License for more details. 16 ;; General Public License for more details.
17 17
18 ;; You should have received a copy of the GNU General Public License 18 ;; You should have received a copy of the GNU General Public License
19 ;; along with XEmacs; see the file COPYING. If not, write to the 19 ;; along with XEmacs; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 ;; Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA. 21 ;; Boston, MA 02111-1307, USA.
22 22
23 ;;; Synched up with: FSF 19.30 buffer.c. 23 ;;; Synched up with: FSF 19.30 buffer.c.
24 24
25 ;;; Code: 25 ;;; Code:
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."
71 ;; #ifdef I18N3 70 ;; #ifdef I18N3
72 ;; #### Doc string should indicate that the buffer name will get 71 ;; #### Doc string should indicate that the buffer name will get
73 ;; translated. 72 ;; translated.
74 ;; #endif 73 ;; #endif
75 ;; This is twisted. It is evil to throw the keyboard focus around 74 (let (buf window frame)
76 ;; willy-nilly if the user wants focus-follows-mouse.
77 (let ((oldbuf (current-buffer))
78 buf window frame)
79 (if (null bufname) 75 (if (null bufname)
80 (setq buf (other-buffer (current-buffer))) 76 (setq buf (other-buffer (current-buffer)))
81 (setq buf (get-buffer bufname)) 77 (setq buf (get-buffer bufname))
82 (if (null buf) 78 (if (null buf)
83 (progn 79 (progn
86 (push-window-configuration) 82 (push-window-configuration)
87 (set-buffer buf) 83 (set-buffer buf)
88 (setq window (display-buffer buf not-this-window-p on-frame)) 84 (setq window (display-buffer buf not-this-window-p on-frame))
89 (setq frame (window-frame window)) 85 (setq frame (window-frame window))
90 ;; if the display-buffer hook decided to show this buffer in another 86 ;; if the display-buffer hook decided to show this buffer in another
91 ;; frame, then select that frame, (unless obeying focus-follows-mouse -sb). 87 ;; frame, then select that frame.
92 (if (and (not focus-follows-mouse) 88 (if (not (eq frame (selected-frame)))
93 (not (eq frame (selected-frame))))
94 (select-frame frame)) 89 (select-frame frame))
95 (record-buffer buf) 90 (record-buffer buf)
96 (if (and focus-follows-mouse 91 (select-window window)
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))
102 buf)) 92 buf))