aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2011-09-05 10:32:50 +0200
committerJoakim Verona2011-09-05 10:32:50 +0200
commitd47f8c5baeaa804548a73675077c8e37cdfe5142 (patch)
tree331e719c2f9d901e6baad46f40bc2fbd34fd7a76
parentfd1f30fdeb58128bbf606204260faed20933a0b3 (diff)
parent2a7bdc1a6f23854cbac90a29907367a1b8cd54d9 (diff)
downloademacs-d47f8c5baeaa804548a73675077c8e37cdfe5142.tar.gz
emacs-d47f8c5baeaa804548a73675077c8e37cdfe5142.zip
disabled cavas demo code by default since people have issues building. it can be enabled explicitly
-rw-r--r--README.xwidget4
-rw-r--r--configure.in12
-rw-r--r--lisp/ChangeLog52
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/gnus-sum.el10
-rw-r--r--lisp/minibuffer.el10
-rw-r--r--lisp/view.el6
-rw-r--r--lisp/window.el589
8 files changed, 408 insertions, 280 deletions
diff --git a/README.xwidget b/README.xwidget
index 74054165edd..bec536393a1 100644
--- a/README.xwidget
+++ b/README.xwidget
@@ -1319,9 +1319,9 @@ for (var i=0; i<frames.length; i++)
1319 } 1319 }
1320 1320
1321 1321
1322** TODO support downstreams 1322** support downstreams
1323http://aur.archlinux.org/packages.php?ID=48230 1323http://aur.archlinux.org/packages.php?ID=48230
1324 1324** TODO the proof of concept canvas code should be disabled by default.
1325** TODO advi 1325** TODO advi
1326active dvi viewer. investigate if it could be xwidgetified. 1326active dvi viewer. investigate if it could be xwidgetified.
1327advi supports embedding inside presentations. 1327advi supports embedding inside presentations.
diff --git a/configure.in b/configure.in
index 4a3d5f5d900..adb9d1e8795 100644
--- a/configure.in
+++ b/configure.in
@@ -1994,16 +1994,18 @@ if test "${with_xwidgets}" != "no"; then
1994 AC_DEFINE(HAVE_WEBKIT_OSR, 1, [Define to 1 if you have webkit_osr support.]) 1994 AC_DEFINE(HAVE_WEBKIT_OSR, 1, [Define to 1 if you have webkit_osr support.])
1995 fi 1995 fi
1996 fi 1996 fi
1997 1997
1998 CLUTTER_REQUIRED=1.0.0 1998 if test "${with_xwdemo}" = "yes"; then
1999#clutter and goocanvas are just proof of concept so disable for now
2000 CLUTTER_REQUIRED=1.0.0
1999 CLUTTER_MODULES="clutter-gtk-1.0 >= $CLUTTER_REQUIRED" 2001 CLUTTER_MODULES="clutter-gtk-1.0 >= $CLUTTER_REQUIRED"
2000 2002
2001 PKG_CHECK_MODULES(CLUTTER, $CLUTTER_MODULES, HAVE_CLUTTER=yes, HAVE_CLUTTER=no) 2003 PKG_CHECK_MODULES(CLUTTER, $CLUTTER_MODULES, HAVE_CLUTTER=yes, HAVE_CLUTTER=no)
2002 if test $HAVE_CLUTTER = yes; then 2004 if test $HAVE_CLUTTER = yes; then
2003 AC_DEFINE(HAVE_CLUTTER, 1, [Define to 1 if you have clutter support.]) 2005 AC_DEFINE(HAVE_CLUTTER, 1, [Define to 1 if you have clutter support.])
2004 fi 2006 fi
2005 2007
2006#TODO 2008
2007 GOOCANVAS_REQUIRED=1.4.0 2009 GOOCANVAS_REQUIRED=1.4.0
2008 GOOCANVAS_MODULES="goocanvasgtk-3.0 >= $GOOCANVAS_REQUIRED" 2010 GOOCANVAS_MODULES="goocanvasgtk-3.0 >= $GOOCANVAS_REQUIRED"
2009 2011
@@ -2011,7 +2013,7 @@ if test "${with_xwidgets}" != "no"; then
2011 if test $HAVE_GOOCANVAS = yes; then 2013 if test $HAVE_GOOCANVAS = yes; then
2012 AC_DEFINE(HAVE_GOOCANVAS, 1, [Define to 1 if you have goocanvas support.]) 2014 AC_DEFINE(HAVE_GOOCANVAS, 1, [Define to 1 if you have goocanvas support.])
2013 fi 2015 fi
2014 2016 fi
2015fi 2017fi
2016 2018
2017 2019
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b4b95fb4074..7ea1dffe1c2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,39 @@
12011-09-02 Chong Yidong <cyd@stupidchicken.com>
2
3 * window.el (display-buffer-alist): Doc fix.
4 (display-buffer): Add docstring. Don't treat
5 display-buffer-default specially.
6 (display-buffer-reuse-selected-window)
7 (display-buffer-same-window, display-buffer-maybe-same-window)
8 (display-buffer-reuse-window, display-buffer-pop-up-frame)
9 (display-buffer-pop-up-window)
10 (display-buffer-reuse-or-pop-window)
11 (display-buffer-use-some-window): New functions.
12 (display-buffer-default-action): Use them.
13 (display-buffer-default): Deleted.
14 (pop-to-buffer-1): Fix choice of actions.
15
162011-09-02 Stefan Monnier <monnier@iro.umontreal.ca>
17
18 * minibuffer.el (completion--insert-strings): Don't get confused by
19 completion entries that end with an LF char.
20
212011-09-01 Eli Zaretskii <eliz@gnu.org>
22
23 * window.el (frame-auto-delete, window-deletable-p): Doc fix.
24
252011-09-01 Chong Yidong <cyd@stupidchicken.com>
26
27 * window.el (display-buffer): Restore interactive spec.
28 (display-buffer-same-window, display-buffer-other-window):
29 New functions.
30 (pop-to-buffer-1): New function. Use the above.
31 (pop-to-buffer, pop-to-buffer-same-window): Use it.
32 (pop-to-buffer-other-window, pop-to-buffer-other-frame): Delete.
33
34 * view.el (view-buffer-other-window, view-buffer-other-frame):
35 Just use pop-to-buffer.
36
12011-09-01 Thierry Volpiatto <thierry.volpiatto@gmail.com> 372011-09-01 Thierry Volpiatto <thierry.volpiatto@gmail.com>
2 38
3 * vc/vc-rcs.el (vc-rcs-responsible-p): Handle directories. (Bug#9391) 39 * vc/vc-rcs.el (vc-rcs-responsible-p): Handle directories. (Bug#9391)
@@ -44,8 +80,8 @@
44 (display-buffer-alist-set-1, display-buffer-alist-set-2) 80 (display-buffer-alist-set-1, display-buffer-alist-set-2)
45 (display-buffer-alist-set): Remove. 81 (display-buffer-alist-set): Remove.
46 (display-buffer-function, special-display-buffer-names) 82 (display-buffer-function, special-display-buffer-names)
47 (special-display-regexps, special-display-function): In 83 (special-display-regexps, special-display-function):
48 doc-string refer to display-buffer-window and quit-restore 84 In doc-string refer to display-buffer-window and quit-restore
49 parameter. 85 parameter.
50 (pop-up-frame-alist, pop-up-frame-function, special-display-p) 86 (pop-up-frame-alist, pop-up-frame-function, special-display-p)
51 (special-display-frame-alist, special-display-popup-frame) 87 (special-display-frame-alist, special-display-popup-frame)
@@ -56,8 +92,8 @@
56 (split-window-sensibly, window--try-to-split-window) 92 (split-window-sensibly, window--try-to-split-window)
57 (window--frame-usable-p, even-window-heights) 93 (window--frame-usable-p, even-window-heights)
58 (window--even-window-heights, window--display-buffer-1) 94 (window--even-window-heights, window--display-buffer-1)
59 (window--display-buffer-2, display-buffer-other-frame): Restore 95 (window--display-buffer-2, display-buffer-other-frame):
60 old Emacs 23 code, order and doc-strings where applicable. 96 Restore old Emacs 23 code, order and doc-strings where applicable.
61 (display-buffer-default, display-buffer-assq-regexp): New functions. 97 (display-buffer-default, display-buffer-assq-regexp): New functions.
62 (display-buffer-alist): Rewrite doc-string. 98 (display-buffer-alist): Rewrite doc-string.
63 (display-buffer-default-action) 99 (display-buffer-default-action)
@@ -69,8 +105,8 @@
69 Restore Emacs 23 behavior but use 105 Restore Emacs 23 behavior but use
70 window-normalize-buffer-to-switch-to. 106 window-normalize-buffer-to-switch-to.
71 (pop-to-buffer-same-window): Rewrite. 107 (pop-to-buffer-same-window): Rewrite.
72 (pop-to-buffer-other-window, pop-to-buffer-other-frame): Rewrite 108 (pop-to-buffer-other-window, pop-to-buffer-other-frame):
73 using Emacs 23 options. 109 Rewrite using Emacs 23 options.
74 110
752011-08-31 Michael Albinus <michael.albinus@gmx.de> 1112011-08-31 Michael Albinus <michael.albinus@gmx.de>
76 112
@@ -79,8 +115,8 @@
79 (tramp-completion-file-name-regexp-separate) 115 (tramp-completion-file-name-regexp-separate)
80 (tramp-completion-file-name-regexp-url): Don't use leading volume 116 (tramp-completion-file-name-regexp-url): Don't use leading volume
81 letter on win32 systems. (Bug#5303, Bug#9311) 117 letter on win32 systems. (Bug#5303, Bug#9311)
82 (tramp-drop-volume-letter): Simplify definition. Suggested by 118 (tramp-drop-volume-letter): Simplify definition.
83 Stefan Monnier <monnier@iro.umontreal.ca>. 119 Suggested by Stefan Monnier <monnier@iro.umontreal.ca>.
84 120
852011-08-30 Stefan Monnier <monnier@iro.umontreal.ca> 1212011-08-30 Stefan Monnier <monnier@iro.umontreal.ca>
86 122
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 71872b21adb..8646f687420 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
12011-09-01 Andrew Cohen <cohen@andy.bu.edu>
2
3 * gnus-sum.el: When adding article headers to a summary buffer also
4 update gnus-newsgroup-articles (bug#9386).
5
12011-08-30 Katsumi Yamaoka <yamaoka@jpl.org> 62011-08-30 Katsumi Yamaoka <yamaoka@jpl.org>
2 7
3 * auth-source.el: Autoload help-mode. 8 * auth-source.el: Autoload help-mode.
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index c01f91973a0..fd441c46d17 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -8630,6 +8630,8 @@ fetched for this group."
8630 'list gnus-newsgroup-headers 8630 'list gnus-newsgroup-headers
8631 (gnus-fetch-headers articles nil t) 8631 (gnus-fetch-headers articles nil t)
8632 'gnus-article-sort-by-number)) 8632 'gnus-article-sort-by-number))
8633 (setq gnus-newsgroup-articles
8634 (gnus-sorted-nunion gnus-newsgroup-articles articles))
8633 (gnus-summary-limit (append articles gnus-newsgroup-limit)))) 8635 (gnus-summary-limit (append articles gnus-newsgroup-limit))))
8634 8636
8635(defun gnus-summary-limit-exclude-dormant () 8637(defun gnus-summary-limit-exclude-dormant ()
@@ -9022,9 +9024,11 @@ non-numeric or nil fetch the number specified by the
9022 (keep-lines 9024 (keep-lines
9023 (regexp-opt ',(append refs (list id subject))))))) 9025 (regexp-opt ',(append refs (list id subject)))))))
9024 (gnus-fetch-headers (list last) (if (numberp limit) 9026 (gnus-fetch-headers (list last) (if (numberp limit)
9025 (* 2 limit) limit) t))))) 9027 (* 2 limit) limit) t))))
9028 article-ids)
9026 (when (listp new-headers) 9029 (when (listp new-headers)
9027 (dolist (header new-headers) 9030 (dolist (header new-headers)
9031 (push (mail-header-number header) article-ids)
9028 (when (member (mail-header-number header) gnus-newsgroup-unselected) 9032 (when (member (mail-header-number header) gnus-newsgroup-unselected)
9029 (push (mail-header-number header) gnus-newsgroup-unreads) 9033 (push (mail-header-number header) gnus-newsgroup-unreads)
9030 (setq gnus-newsgroup-unselected 9034 (setq gnus-newsgroup-unselected
@@ -9035,6 +9039,8 @@ non-numeric or nil fetch the number specified by the
9035 (gnus-merge 9039 (gnus-merge
9036 'list gnus-newsgroup-headers new-headers 9040 'list gnus-newsgroup-headers new-headers
9037 'gnus-article-sort-by-number))) 9041 'gnus-article-sort-by-number)))
9042 (setq gnus-newsgroup-articles
9043 (gnus-sorted-nunion gnus-newsgroup-articles (nreverse article-ids)))
9038 (gnus-summary-limit-include-thread id)))) 9044 (gnus-summary-limit-include-thread id))))
9039 9045
9040(defun gnus-summary-refer-article (message-id) 9046(defun gnus-summary-refer-article (message-id)
@@ -12743,6 +12749,8 @@ returned."
12743 gnus-newsgroup-headers 12749 gnus-newsgroup-headers
12744 (gnus-fetch-headers articles) 12750 (gnus-fetch-headers articles)
12745 'gnus-article-sort-by-number)) 12751 'gnus-article-sort-by-number))
12752 (setq gnus-newsgroup-articles
12753 (gnus-sorted-nunion gnus-newsgroup-articles articles))
12746 ;; Suppress duplicates? 12754 ;; Suppress duplicates?
12747 (when gnus-suppress-duplicates 12755 (when gnus-suppress-duplicates
12748 (gnus-dup-suppress-articles)) 12756 (gnus-dup-suppress-articles))
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 313298de97e..820b1599abb 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1076,12 +1076,15 @@ It also eliminates runs of equal strings."
1076 (column 0) 1076 (column 0)
1077 (rows (/ (length strings) columns)) 1077 (rows (/ (length strings) columns))
1078 (row 0) 1078 (row 0)
1079 (first t)
1079 (laststring nil)) 1080 (laststring nil))
1080 ;; The insertion should be "sensible" no matter what choices were made 1081 ;; The insertion should be "sensible" no matter what choices were made
1081 ;; for the parameters above. 1082 ;; for the parameters above.
1082 (dolist (str strings) 1083 (dolist (str strings)
1083 (unless (equal laststring str) ; Remove (consecutive) duplicates. 1084 (unless (equal laststring str) ; Remove (consecutive) duplicates.
1084 (setq laststring str) 1085 (setq laststring str)
1086 ;; FIXME: `string-width' doesn't pay attention to
1087 ;; `display' properties.
1085 (let ((length (if (consp str) 1088 (let ((length (if (consp str)
1086 (+ (string-width (car str)) 1089 (+ (string-width (car str))
1087 (string-width (cadr str))) 1090 (string-width (cadr str)))
@@ -1100,11 +1103,11 @@ It also eliminates runs of equal strings."
1100 (forward-line 1) 1103 (forward-line 1)
1101 (end-of-line))) 1104 (end-of-line)))
1102 (insert " \t") 1105 (insert " \t")
1103 (set-text-properties (- (point) 1) (point) 1106 (set-text-properties (1- (point)) (point)
1104 `(display (space :align-to ,column))))) 1107 `(display (space :align-to ,column)))))
1105 (t 1108 (t
1106 ;; Horizontal format 1109 ;; Horizontal format
1107 (unless (bolp) 1110 (unless first
1108 (if (< wwidth (+ (max colwidth length) column)) 1111 (if (< wwidth (+ (max colwidth length) column))
1109 ;; No space for `str' at point, move to next line. 1112 ;; No space for `str' at point, move to next line.
1110 (progn (insert "\n") (setq column 0)) 1113 (progn (insert "\n") (setq column 0))
@@ -1112,12 +1115,13 @@ It also eliminates runs of equal strings."
1112 ;; Leave the space unpropertized so that in the case we're 1115 ;; Leave the space unpropertized so that in the case we're
1113 ;; already past the goal column, there is still 1116 ;; already past the goal column, there is still
1114 ;; a space displayed. 1117 ;; a space displayed.
1115 (set-text-properties (- (point) 1) (point) 1118 (set-text-properties (1- (point)) (point)
1116 ;; We can't just set tab-width, because 1119 ;; We can't just set tab-width, because
1117 ;; completion-setup-function will kill 1120 ;; completion-setup-function will kill
1118 ;; all local variables :-( 1121 ;; all local variables :-(
1119 `(display (space :align-to ,column))) 1122 `(display (space :align-to ,column)))
1120 nil)))) 1123 nil))))
1124 (setq first nil)
1121 (if (not (consp str)) 1125 (if (not (consp str))
1122 (put-text-property (point) (progn (insert str) (point)) 1126 (put-text-property (point) (progn (insert str) (point))
1123 'mouse-face 'highlight) 1127 'mouse-face 'highlight)
diff --git a/lisp/view.el b/lisp/view.el
index be011d217fc..96fecd9df1c 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -338,7 +338,8 @@ Optional argument EXIT-ACTION is either nil or a function with buffer as
338argument. This function is called when finished viewing buffer. Use 338argument. This function is called when finished viewing buffer. Use
339this argument instead of explicitly setting `view-exit-action'." 339this argument instead of explicitly setting `view-exit-action'."
340 (interactive "bIn other window view buffer:\nP") 340 (interactive "bIn other window view buffer:\nP")
341 (pop-to-buffer-other-window buffer) 341 (let ((pop-up-windows t))
342 (pop-to-buffer buffer t))
342 (view-mode-enter nil exit-action)) 343 (view-mode-enter nil exit-action))
343 344
344;;;###autoload 345;;;###autoload
@@ -358,7 +359,8 @@ Optional argument EXIT-ACTION is either nil or a function with buffer as
358argument. This function is called when finished viewing buffer. Use 359argument. This function is called when finished viewing buffer. Use
359this argument instead of explicitly setting `view-exit-action'." 360this argument instead of explicitly setting `view-exit-action'."
360 (interactive "bView buffer in other frame: \nP") 361 (interactive "bView buffer in other frame: \nP")
361 (pop-to-buffer-other-frame buffer) 362 (let ((pop-up-frames t))
363 (pop-to-buffer buffer t))
362 (view-mode-enter nil exit-action)) 364 (view-mode-enter nil exit-action))
363 365
364;;;###autoload 366;;;###autoload
diff --git a/lisp/window.el b/lisp/window.el
index 50deb035420..8bdf4131c51 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2259,10 +2259,10 @@ and no others."
2259 2259
2260;;; Deleting windows. 2260;;; Deleting windows.
2261(defcustom frame-auto-delete 'automatic 2261(defcustom frame-auto-delete 'automatic
2262 "If non-nil, quitting a window can delete it's frame. 2262 "If non-nil, quitting a window can delete its frame.
2263If this variable is nil, functions that quit a window never 2263If this variable is nil, functions that quit a window never
2264delete the associated frame. If this variable equals the symbol 2264delete the associated frame. If this variable's value is the
2265`automatic', a frame is deleted only if it the window is 2265symbol `automatic', a frame is deleted only if the window is
2266dedicated or was created by `display-buffer'. If this variable 2266dedicated or was created by `display-buffer'. If this variable
2267is t, a frame can be always deleted, even if it was created by 2267is t, a frame can be always deleted, even if it was created by
2268`make-frame-command'. Other values should not be used. 2268`make-frame-command'. Other values should not be used.
@@ -2282,8 +2282,8 @@ variable are `switch-to-prev-buffer', `delete-windows-on',
2282 2282
2283(defun window-deletable-p (&optional window) 2283(defun window-deletable-p (&optional window)
2284 "Return t if WINDOW can be safely deleted from its frame. 2284 "Return t if WINDOW can be safely deleted from its frame.
2285Return `frame' if deleting WINDOW should delete its frame 2285Return `frame' if deleting WINDOW should also delete its
2286instead." 2286frame."
2287 (setq window (window-normalize-any-window window)) 2287 (setq window (window-normalize-any-window window))
2288 (unless ignore-window-parameters 2288 (unless ignore-window-parameters
2289 ;; Handle atomicity. 2289 ;; Handle atomicity.
@@ -2304,7 +2304,7 @@ instead."
2304 (other-visible-frames-p frame)) 2304 (other-visible-frames-p frame))
2305 ;; WINDOW is the root window of its frame. Return `frame' but 2305 ;; WINDOW is the root window of its frame. Return `frame' but
2306 ;; only if WINDOW is (1) either dedicated or quit-restore's car 2306 ;; only if WINDOW is (1) either dedicated or quit-restore's car
2307 ;; is new-frame and the window still displays the same buffer 2307 ;; is `new-frame' and the window still displays the same buffer
2308 ;; and (2) there are other frames left. 2308 ;; and (2) there are other frames left.
2309 'frame)) 2309 'frame))
2310 ((and (not ignore-window-parameters) 2310 ((and (not ignore-window-parameters)
@@ -4478,155 +4478,6 @@ Return WINDOW."
4478The actual non-nil value of this variable will be copied to the 4478The actual non-nil value of this variable will be copied to the
4479`window-dedicated-p' flag.") 4479`window-dedicated-p' flag.")
4480 4480
4481(defun display-buffer-default (buffer-or-name &optional not-this-window frame)
4482 "Make buffer BUFFER-OR-NAME appear in some window but don't select it.
4483BUFFER-OR-NAME must be a buffer or the name of an existing
4484buffer. Return the window chosen to display BUFFER-OR-NAME or
4485nil if no such window is found.
4486
4487Optional argument NOT-THIS-WINDOW non-nil means display the
4488buffer in a window other than the selected one, even if it is
4489already displayed in the selected window.
4490
4491Optional argument FRAME specifies which frames to investigate
4492when the specified buffer is already displayed. If the buffer is
4493already displayed in some window on one of these frames simply
4494return that window. Possible values of FRAME are:
4495
4496`visible' - consider windows on all visible frames on the current
4497terminal.
4498
44990 - consider windows on all visible or iconified frames on the
4500current terminal.
4501
4502t - consider windows on all frames.
4503
4504A specific frame - consider windows on that frame only.
4505
4506nil - consider windows on the selected frame \(actually the
4507last non-minibuffer frame\) only. If, however, either
4508`display-buffer-reuse-frames' or `pop-up-frames' is non-nil
4509\(non-nil and not graphic-only on a text-only terminal),
4510consider all visible or iconified frames on the current terminal."
4511 (interactive "BDisplay buffer:\nP")
4512 (let* ((can-use-selected-window
4513 ;; The selected window is usable unless either NOT-THIS-WINDOW
4514 ;; is non-nil, it is dedicated to its buffer, or it is the
4515 ;; `minibuffer-window'.
4516 (not (or not-this-window
4517 (window-dedicated-p (selected-window))
4518 (window-minibuffer-p))))
4519 (buffer (if (bufferp buffer-or-name)
4520 buffer-or-name
4521 (get-buffer buffer-or-name)))
4522 (name-of-buffer (buffer-name buffer))
4523 ;; On text-only terminals do not pop up a new frame when
4524 ;; `pop-up-frames' equals graphic-only.
4525 (use-pop-up-frames (if (eq pop-up-frames 'graphic-only)
4526 (display-graphic-p)
4527 pop-up-frames))
4528 ;; `frame-to-use' is the frame where to show `buffer' - either
4529 ;; the selected frame or the last nonminibuffer frame.
4530 (frame-to-use
4531 (or (window--frame-usable-p (selected-frame))
4532 (window--frame-usable-p (last-nonminibuffer-frame))))
4533 ;; `window-to-use' is the window we use for showing `buffer'.
4534 window-to-use popped-up-frame)
4535 (cond
4536 ((not (buffer-live-p buffer))
4537 (error "No such buffer %s" buffer))
4538 (display-buffer-function
4539 ;; Let `display-buffer-function' do the job.
4540 (funcall display-buffer-function buffer not-this-window))
4541 ((and (not not-this-window)
4542 (eq (window-buffer (selected-window)) buffer))
4543 ;; The selected window already displays BUFFER and
4544 ;; `not-this-window' is nil, so use it.
4545 (display-buffer-record-window 'reuse-window (selected-window) buffer)
4546 (window--display-buffer-1 (selected-window)))
4547 ((and can-use-selected-window (same-window-p name-of-buffer))
4548 ;; If the buffer's name tells us to use the selected window do so.
4549 (display-buffer-record-window 'reuse-window (selected-window) buffer)
4550 (window--display-buffer-2 buffer (selected-window)))
4551 ((let ((frames (or frame
4552 (and (or use-pop-up-frames
4553 display-buffer-reuse-frames
4554 (not (last-nonminibuffer-frame)))
4555 0)
4556 (last-nonminibuffer-frame))))
4557 (setq window-to-use
4558 (catch 'found
4559 ;; Search frames for a window displaying BUFFER. Return
4560 ;; the selected window only if we are allowed to do so.
4561 (dolist (window (get-buffer-window-list buffer 'nomini frames))
4562 (when (or can-use-selected-window
4563 (not (eq (selected-window) window)))
4564 (throw 'found window))))))
4565 ;; The buffer is already displayed in some window; use that.
4566 (display-buffer-record-window 'reuse-window window-to-use buffer)
4567 (window--display-buffer-1 window-to-use))
4568 ((and special-display-function
4569 ;; `special-display-p' returns either t or a list of frame
4570 ;; parameters to pass to `special-display-function'.
4571 (let ((pars (special-display-p name-of-buffer)))
4572 (when pars
4573 (funcall special-display-function
4574 buffer (if (listp pars) pars))))))
4575 ((or use-pop-up-frames (not frame-to-use))
4576 ;; We want or need a new frame.
4577 (setq window-to-use
4578 (frame-selected-window (funcall pop-up-frame-function)))
4579 (display-buffer-record-window 'pop-up-frame window-to-use buffer)
4580 (window--display-buffer-2 buffer window-to-use))
4581 ((and pop-up-windows
4582 ;; Make a new window.
4583 (or (not (frame-parameter frame-to-use 'unsplittable))
4584 ;; If the selected frame cannot be split look at
4585 ;; `last-nonminibuffer-frame'.
4586 (and (eq frame-to-use (selected-frame))
4587 (setq frame-to-use (last-nonminibuffer-frame))
4588 (window--frame-usable-p frame-to-use)
4589 (not (frame-parameter frame-to-use 'unsplittable))))
4590 ;; Attempt to split largest or least recently used window.
4591 (setq window-to-use
4592 (or (window--try-to-split-window
4593 (get-largest-window frame-to-use t))
4594 (window--try-to-split-window
4595 (get-lru-window frame-to-use t))))
4596 (display-buffer-record-window 'pop-up-window window-to-use buffer)
4597 (window--display-buffer-2 buffer window-to-use)))
4598 ((let ((window-to-undedicate
4599 ;; When NOT-THIS-WINDOW is non-nil, temporarily dedicate
4600 ;; the selected window to its buffer, to avoid that some of
4601 ;; the `get-' routines below choose it. (Bug#1415)
4602 (and not-this-window (not (window-dedicated-p))
4603 (set-window-dedicated-p (selected-window) t)
4604 (selected-window))))
4605 (unwind-protect
4606 (setq window-to-use
4607 ;; Reuse an existing window.
4608 (or (get-lru-window frame-to-use)
4609 (let ((window (get-buffer-window buffer 'visible)))
4610 (unless (and not-this-window
4611 (eq window (selected-window)))
4612 window))
4613 (get-largest-window 'visible)
4614 (let ((window (get-buffer-window buffer 0)))
4615 (unless (and not-this-window
4616 (eq window (selected-window)))
4617 window))
4618 (get-largest-window 0)
4619 (prog1
4620 (frame-selected-window (funcall pop-up-frame-function))
4621 (setq popped-up-frame t))))
4622 (when (window-live-p window-to-undedicate)
4623 ;; Restore dedicated status of selected window.
4624 (set-window-dedicated-p window-to-undedicate nil))))
4625 (display-buffer-record-window
4626 (if popped-up-frame 'pop-up-frame 'reuse-window) window-to-use buffer)
4627 (window--even-window-heights window-to-use)
4628 (window--display-buffer-2 buffer window-to-use)))))
4629
4630(defun window-normalize-buffer-to-display (buffer-or-name) 4481(defun window-normalize-buffer-to-display (buffer-or-name)
4631 "Normalize BUFFER-OR-NAME argument for buffer display functions. 4482 "Normalize BUFFER-OR-NAME argument for buffer display functions.
4632If BUFFER-OR-NAME is nil, return the curent buffer. Else, if a 4483If BUFFER-OR-NAME is nil, return the curent buffer. Else, if a
@@ -4641,24 +4492,52 @@ BUFFER-OR-NAME and return that buffer."
4641 (current-buffer))) 4492 (current-buffer)))
4642 4493
4643(defvar display-buffer-alist nil 4494(defvar display-buffer-alist nil
4644 "Specifications of user preferences for `display-buffer'. 4495 "Alist of conditional actions for `display-buffer'.
4645This is a list of elements of the form (CONDITION . ACTION) where 4496This is a list of elements (CONDITION . ACTION), where:
4646CONDITION is either a regexp matching buffer names, or a function 4497
4647that takes a buffer and returns a boolean. ACTION is a list of 4498 CONDITION is either a regexp matching buffer names, or a function
4648the form (FUNCTION . ALIST) where FUNCTION can be either a 4499 that takes a buffer and returns a boolean.
4649function or a list of functions. Those functions will be called 4500
4650with 2 arguments: the buffer to display and an ALIST built from 4501 ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is
4651the various alists specified in the various ACTIONs. It should 4502 either a function or a list of functions. Each such function
4652either return the window used, or nil to fallback to the next 4503 should accept 2 arguments: a buffer to display and an alist of
4653function.") 4504 the same form as ALIST. It should return the window used, or
4654 4505 nil if it fails to display the window. See `display-buffer'
4655(defvar display-buffer-default-action (list #'display-buffer-default) 4506 for more details.
4656 "Default action to perform to display a buffer. 4507
4657This is an ACTION just like in `display-buffer-alist'.") 4508Usable action functions include:
4658 4509 `display-buffer-reuse-selected-window'
4659(defvar display-buffer-overriding-action '(nil) 4510 `display-buffer-same-window'
4511 `display-buffer-maybe-same-window'
4512 `display-buffer-reuse-window'
4513 `display-buffer-pop-up-frame'
4514 `display-buffer-pop-up-window'
4515 `display-buffer-reuse-or-pop-window'
4516 `display-buffer-use-some-window'
4517
4518The above functions recognize the following alist entries:
4519 - `inhibit-same-window', if non-nil, prevents the same window
4520 from being used for display.
4521 - `reuse-frame' specifies the frames that can be searched for a
4522 window displaying the buffer. Its values have the same
4523 meaning as the ALL-FRAMES arg to `get-buffer-window-list'.")
4524
4525(defvar display-buffer-default-action
4526 '((display-buffer-reuse-selected-window
4527 display-buffer-maybe-same-window
4528 display-buffer-reuse-or-pop-window
4529 display-buffer-use-some-window
4530 ;; If all else fails, pop up a new frame regardless of
4531 ;; restrictions.
4532 display-buffer-pop-up-frame))
4533 "List of default actions for `display-buffer'.
4534It should be a cons cell of the form (FUNCTION . ALIST), which
4535has the same meaning as in `display-buffer-alist'.")
4536
4537(defvar display-buffer-overriding-action nil
4660 "Overriding action to perform to display a buffer. 4538 "Overriding action to perform to display a buffer.
4661This is an ACTION just like in `display-buffer-alist'.") 4539If non-nil, it should be a cons cell (FUNCTION . ALIST), which
4540has the same meaning as in `display-buffer-alist'.")
4662 4541
4663(defun display-buffer-assq-regexp (buffer-name alist) 4542(defun display-buffer-assq-regexp (buffer-name alist)
4664 "Retrieve ALIST entry corresponding to BUFFER-NAME." 4543 "Retrieve ALIST entry corresponding to BUFFER-NAME."
@@ -4673,45 +4552,73 @@ This is an ACTION just like in `display-buffer-alist'.")
4673 (throw 'match (cdr entry))))))) 4552 (throw 'match (cdr entry)))))))
4674 4553
4675(defun display-buffer (&optional buffer-or-name action frame) 4554(defun display-buffer (&optional buffer-or-name action frame)
4676 "Display BUFFER in some window." 4555 "Display BUFFER-OR-NAME in some window.
4677 (let* ((buffer (window-normalize-buffer-to-display buffer-or-name)) 4556BUFFER-OR-NAME must be a buffer or the name of an existing
4678 (buffer-name (buffer-name buffer)) 4557buffer. Return the window chosen for displaying BUFFER-OR-NAME,
4679 (user-action 4558or nil if no such window is found.
4680 (display-buffer-assq-regexp buffer-name display-buffer-alist)) 4559
4681 (functions 4560Optional argument ACTION should have the form (FUNCTION . ALIST).
4682 (append 4561FUNCTION is either a function or a list of functions. Each such
4683 (list (car display-buffer-overriding-action)) 4562function is called with 2 arguments: the buffer to display and an
4684 (list (car user-action)) 4563alist. It should either display the buffer and return the
4685 (and (listp action) (list (car action))) 4564window, or return nil if it is unable to display the buffer.
4686 (list (car display-buffer-default-action)))) 4565
4687 (specifiers (append (cdr display-buffer-overriding-action) 4566`display-buffer' constructs a list of action functions and an
4688 (cdr user-action) 4567action alist by combining `display-buffer-overriding-action',
4689 (and (listp action) (cdr action)) 4568`display-buffer-alist', the ACTION argument, and
4690 (cdr display-buffer-default-action))) 4569`display-buffer-default-action' (in that order). It calls each
4691 function window) 4570action function in turn, passing the combined action alist as the
4692 (while (and functions (not window)) 4571second argument, until one of the functions returns non-nil.
4693 (setq function (car functions)) 4572
4694 (cond 4573The ACTION argument to `display-buffer' can also have a non-nil
4695 ((listp function) 4574and non-list value. This means to display the buffer in a window
4696 (while (and function (not window)) 4575other than the selected one, even if it is already displayed in
4697 (cond 4576the selected window. If called interactively with a prefix
4698 ((eq (car function) 'display-buffer-default) 4577argument, ACTION is t.
4699 (setq window 4578
4700 (display-buffer-default 4579Optional argument FRAME specifies where to look for a window that
4701 buffer (memq action '(t other-window)) frame))) 4580already displays the buffer. If nil, check only the selected
4702 ((functionp (car function)) 4581frame (actually the last non-minibuffer frame), except if
4703 (setq window (funcall (car function) buffer specifiers)))) 4582`display-buffer-reuse-frames' or `pop-up-frames' is non-nil
4704 (setq function (cdr function)))) 4583\(non-nil and not graphic-only on a text-only terminal), in which
4705 ((eq function 'display-buffer-default) 4584case check all visible or iconified frames. Otherwise, FRAME can
4706 (setq window 4585be a specific frame, `visible' (all visible frames), 0 (all
4707 (display-buffer-default 4586frames on the current terminal), or t (all frames)."
4708 buffer (memq action '(t other-window)) frame))) 4587 (interactive "BDisplay buffer:\nP")
4709 ((functionp function) 4588 (let ((buffer (window-normalize-buffer-to-display buffer-or-name))
4710 (setq window 4589 ;; Handle the old form of the first argument.
4711 (funcall function buffer specifiers)))) 4590 (inhibit-same-window (and action (not (listp action)))))
4712 (setq functions (cdr functions))) 4591 (unless (listp action) (setq action nil))
4713 4592 (if display-buffer-function
4714 window)) 4593 ;; If `display-buffer-function' is defined, let it do the job.
4594 (funcall display-buffer-function buffer inhibit-same-window)
4595 ;; Otherwise, use the defined actions.
4596 (let* ((user-action
4597 (display-buffer-assq-regexp (buffer-name buffer)
4598 display-buffer-alist))
4599 ;; Extra actions from the arguments to this function:
4600 (extra-action
4601 (cons nil (append (if inhibit-same-window
4602 '((inhibit-same-window . t)))
4603 (if frame
4604 `((reuse-frame . ,frame))))))
4605 ;; Construct action function list and action alist.
4606 (actions (list display-buffer-overriding-action
4607 user-action action extra-action
4608 display-buffer-default-action))
4609 (functions (apply 'append
4610 (mapcar (lambda (x)
4611 (setq x (car x))
4612 (if (listp x) x (list x)))
4613 actions)))
4614 (alist (apply 'append (mapcar 'cdr actions)))
4615 window)
4616 (unless (buffer-live-p buffer)
4617 (error "Invalid buffer"))
4618 (while (and functions (not window))
4619 (setq window (funcall (car functions) buffer alist)
4620 functions (cdr functions)))
4621 window))))
4715 4622
4716(defun display-buffer-other-frame (buffer) 4623(defun display-buffer-other-frame (buffer)
4717 "Display buffer BUFFER in another frame. 4624 "Display buffer BUFFER in another frame.
@@ -4736,6 +4643,185 @@ its documentation for additional customization information."
4736 ;;(make-frame-visible (window-frame old-window)) 4643 ;;(make-frame-visible (window-frame old-window))
4737 )) 4644 ))
4738 4645
4646;;; `display-buffer' action functions:
4647
4648(defun display-buffer-reuse-selected-window (buffer alist)
4649 "Try to display BUFFER in the selected window if it is already there.
4650If this succeeds, return the selected window.
4651
4652This fails if BUFFER is not displayed in the selected window, or
4653if ALIST has a non-nil `inhibit-same-window' entry. In that
4654case, return nil."
4655 (when (and (not (cdr (assq 'inhibit-same-window alist)))
4656 (eq buffer (window-buffer)))
4657 (display-buffer-record-window 'reuse-window (selected-window) buffer)
4658 (window--display-buffer-1 (selected-window))))
4659
4660(defun display-buffer-same-window (buffer alist)
4661 "Try to display BUFFER in the selected window.
4662If this succeeds, return the selected window.
4663
4664This fails if the selected window is a minibuffer window or is
4665dedicated to another buffer, or if ALIST has a non-nil
4666`inhibit-same-window' entry. In that case, return nil."
4667 (unless (or (cdr (assq 'inhibit-same-window alist))
4668 (window-minibuffer-p)
4669 (window-dedicated-p))
4670 (display-buffer-record-window 'reuse-window (selected-window) buffer)
4671 (window--display-buffer-2 buffer (selected-window))))
4672
4673(defun display-buffer-maybe-same-window (buffer alist)
4674 "Try to display BUFFER in the selected window.
4675This acts like `display-buffer-same-window', except that it also
4676fails if `same-window-p' returns nil for this buffer."
4677 (and (same-window-p (buffer-name buffer))
4678 (display-buffer-same-window buffer alist)))
4679
4680(defun display-buffer-reuse-window (buffer alist)
4681 "Return a window that is already displaying BUFFER.
4682If no usable window is found, return nil.
4683
4684If ALIST has a non-nil `inhibit-same-window' entry, the same
4685window cannot be reused.
4686
4687If ALIST contains a `reuse-frame' entry, that determines the
4688frames to check for a window displaying the buffer. If the entry
4689is omitted or the value is nil, check only this frame. The value
4690can also be a specific frame, `visible' (all visible frames),
46910 (all frames on the current terminal), or t (all frames)."
4692 (let* ((can-use-selected-window
4693 (not (cdr (assq 'inhibit-same-window alist))))
4694 (frames (or (cdr (assq 'reuse-frame alist))
4695 (last-nonminibuffer-frame)))
4696 (window (catch 'found
4697 (dolist (window (get-buffer-window-list
4698 buffer 'nomini frames))
4699 (when (or can-use-selected-window
4700 (not (eq (selected-window) window)))
4701 (throw 'found window))))))
4702 (when window
4703 (display-buffer-record-window 'reuse-window window buffer)
4704 (window--display-buffer-1 window))))
4705
4706(defun display-buffer-pop-up-frame (buffer alist)
4707 "Display BUFFER in a new frame.
4708This works by calling `pop-up-frame-function'. If sucessful,
4709return the window on the new frame; otherwise return nil."
4710 (let ((fun pop-up-frame-function)
4711 frame window)
4712 (when (and fun
4713 (setq frame (funcall fun))
4714 (setq window (frame-selected-window frame)))
4715 (display-buffer-record-window 'pop-up-frame window buffer)
4716 (window--display-buffer-2 buffer window))))
4717
4718(defun display-buffer-pop-up-window (buffer alist)
4719 "Display BUFFER by popping up a new window.
4720The new window is created on the selected frame, or in
4721`last-nonminibuffer-frame' if no windows can be created there.
4722If sucessful, return the new window; otherwise return nil."
4723 (let ((frame (or (window--frame-usable-p (selected-frame))
4724 (window--frame-usable-p (last-nonminibuffer-frame))))
4725 window)
4726 (when (and (or (not (frame-parameter frame 'unsplittable))
4727 ;; If the selected frame cannot be split, look at
4728 ;; `last-nonminibuffer-frame'.
4729 (and (eq frame (selected-frame))
4730 (setq frame (last-nonminibuffer-frame))
4731 (window--frame-usable-p frame)
4732 (not (frame-parameter frame 'unsplittable))))
4733 ;; Attempt to split largest or least recently used window.
4734 (setq window (or (window--try-to-split-window
4735 (get-largest-window frame t))
4736 (window--try-to-split-window
4737 (get-lru-window frame t)))))
4738 (display-buffer-record-window 'pop-up-window window buffer)
4739 (window--display-buffer-2 buffer window))))
4740
4741;; This display action function groups together some lower-level ones:
4742(defun display-buffer-reuse-or-pop-window (buffer alist)
4743 "Display BUFFER in some window other than the selected one.
4744This attempts to call the following functions (in order):
4745 - `display-buffer-reuse-window', ensuring that it checks all
4746 frames on this terminal if `display-buffer-reuse-frames' or
4747 `pop-up-frames' is non-nil.
4748 - `special-display-function', if it is available.
4749 - `display-buffer-pop-up-frame', if specified by `pop-up-frames'.
4750 - `display-buffer-pop-up-window', if specified by `pop-up-windows'.
4751
4752If BUFFER is sucessfully display, return its window; otherwise
4753return nil."
4754 (let ((use-pop-up-frames (if (eq pop-up-frames 'graphic-only)
4755 (display-graphic-p)
4756 pop-up-frames)))
4757 (or (display-buffer-reuse-window
4758 buffer
4759 ;; If `display-buffer-reuse-frames' or `pop-up-frames' is
4760 ;; non-nil, check all frames on this terminal.
4761 (if (and (null (cdr (assq 'reuse-frame alist)))
4762 (or use-pop-up-frames display-buffer-reuse-frames))
4763 (cons '(reuse-frame . 0) alist)
4764 alist))
4765 ;; Try with `special-display-function':
4766 (and special-display-function
4767 ;; `special-display-p' returns either t or a list of frame
4768 ;; parameters to pass to `special-display-function'.
4769 (let ((pars (special-display-p (buffer-name buffer))))
4770 (when pars
4771 (funcall special-display-function
4772 buffer (if (listp pars) pars)))))
4773 (and use-pop-up-frames
4774 (display-buffer-pop-up-frame buffer alist))
4775 (and pop-up-windows
4776 (display-buffer-pop-up-window buffer alist)))))
4777
4778(defun display-buffer-use-some-window (buffer alist)
4779 "Display BUFFER in an existing window.
4780Search for a usable window, set that window to the buffer, and
4781return the window. If no suitable window is found, return nil."
4782 (let* ((not-this-window (cdr (assq 'inhibit-same-window alist)))
4783 (window-to-undedicate
4784 ;; When NOT-THIS-WINDOW is non-nil, temporarily dedicate the
4785 ;; selected window to its buffer, to prevent any of the
4786 ;; `get-' routines below from choosing it. (Bug#1415)
4787 (and not-this-window (not (window-dedicated-p))
4788 (set-window-dedicated-p (selected-window) t)
4789 (selected-window)))
4790 (frame (or (window--frame-usable-p (selected-frame))
4791 (window--frame-usable-p (last-nonminibuffer-frame))))
4792 (use-pop-up-frames (if (eq pop-up-frames 'graphic-only)
4793 (display-graphic-p)
4794 pop-up-frames))
4795 window popped-up-frame)
4796 (unwind-protect
4797 (setq window
4798 ;; Reuse an existing window.
4799 (or (get-lru-window frame)
4800 (let ((window (get-buffer-window buffer 'visible)))
4801 (unless (and not-this-window
4802 (eq window (selected-window)))
4803 window))
4804 (get-largest-window 'visible)
4805 (let ((window (get-buffer-window buffer 0)))
4806 (unless (and not-this-window
4807 (eq window (selected-window)))
4808 window))
4809 (get-largest-window 0)
4810 (and use-pop-up-frames
4811 (prog1
4812 (frame-selected-window (funcall pop-up-frame-function))
4813 (setq popped-up-frame t)))))
4814 (when (window-live-p window-to-undedicate)
4815 ;; Restore dedicated status of selected window.
4816 (set-window-dedicated-p window-to-undedicate nil)))
4817 (when window
4818 (display-buffer-record-window
4819 (if popped-up-frame 'pop-up-frame 'reuse-window) window buffer)
4820 (window--even-window-heights window)
4821 (window--display-buffer-2 buffer window))))
4822
4823;;; Display + selection commands:
4824
4739(defun pop-to-buffer (buffer-or-name &optional other-window norecord) 4825(defun pop-to-buffer (buffer-or-name &optional other-window norecord)
4740 "Select buffer BUFFER-OR-NAME in some window, preferably a different one. 4826 "Select buffer BUFFER-OR-NAME in some window, preferably a different one.
4741BUFFER-OR-NAME may be a buffer, a string \(a buffer name), or 4827BUFFER-OR-NAME may be a buffer, a string \(a buffer name), or
@@ -4759,20 +4845,7 @@ of `display-buffer' for additional customization information.
4759Optional third arg NORECORD non-nil means do not put this buffer 4845Optional third arg NORECORD non-nil means do not put this buffer
4760at the front of the list of recently selected ones." 4846at the front of the list of recently selected ones."
4761 (interactive "BPop to buffer:\nP") 4847 (interactive "BPop to buffer:\nP")
4762 (let ((buffer (window-normalize-buffer-to-display buffer-or-name)) 4848 (pop-to-buffer-1 buffer-or-name (if other-window t nil) norecord))
4763 (old-window (selected-window))
4764 (old-frame (selected-frame))
4765 new-window new-frame)
4766 (set-buffer buffer)
4767 (setq new-window (display-buffer buffer other-window))
4768 (setq new-frame (window-frame new-window))
4769 (if (eq old-frame new-frame)
4770 ;; Make sure new-window gets selected (Bug#8615), (Bug#6954).
4771 (select-window new-window norecord)
4772 ;; `display-buffer' has chosen another frame, make sure it gets
4773 ;; input focus and is risen.
4774 (select-frame-set-input-focus new-frame norecord))
4775 buffer))
4776 4849
4777(defun pop-to-buffer-same-window (&optional buffer-or-name norecord) 4850(defun pop-to-buffer-same-window (&optional buffer-or-name norecord)
4778 "Pop to buffer specified by BUFFER-OR-NAME in the selected window. 4851 "Pop to buffer specified by BUFFER-OR-NAME in the selected window.
@@ -4781,40 +4854,38 @@ the selected window, usually because it is dedicated to another
4781buffer. Optional arguments BUFFER-OR-NAME and NORECORD are as 4854buffer. Optional arguments BUFFER-OR-NAME and NORECORD are as
4782for `pop-to-buffer'." 4855for `pop-to-buffer'."
4783 (interactive "BPop to buffer in selected window:\nP") 4856 (interactive "BPop to buffer in selected window:\nP")
4784 (let ((buffer (window-normalize-buffer-to-display buffer-or-name))) 4857 (pop-to-buffer-1 buffer-or-name 'same-window norecord))
4785 (cond 4858
4786 ((eq buffer (window-buffer)) 4859(defun pop-to-buffer-1 (buffer-or-name window-choice norecord)
4787 (unless norecord 4860 (set-buffer (window-normalize-buffer-to-display
4788 (select-window (selected-window))) 4861 ;; BUFFER-OR-NAME nil means another buffer.
4789 (set-buffer buffer)) 4862 (or buffer-or-name
4790 ((or (window-minibuffer-p) (window-dedicated-p)) 4863 (other-buffer (current-buffer)))))
4791 (pop-to-buffer buffer norecord)) 4864 (let ((old-window (selected-window))
4792 (t 4865 (old-frame (selected-frame))
4793 (set-window-buffer nil buffer) 4866 (same-window-buffer-names same-window-buffer-names)
4794 (unless norecord 4867 (same-window-regexps same-window-regexps))
4795 (select-window (selected-window))) 4868 (if (eq window-choice t)
4796 (set-buffer buffer))))) 4869 (setq same-window-buffer-names nil
4797 4870 same-window-regexps nil))
4798(defun pop-to-buffer-other-window (&optional buffer-or-name norecord) 4871 (let* ((action
4799 "Pop to buffer specified by BUFFER-OR-NAME in another window. 4872 ;; Based on the WINDOW-CHOICE argument, choose an action
4800The selected window will be used only if there is no other 4873 ;; argument to pass to `display-buffer'.
4801choice. Windows on the selected frame are preferred to windows 4874 (cond
4802on other frames. Optional arguments BUFFER-OR-NAME and NORECORD 4875 ((eq window-choice 'same-window)
4803are as for `pop-to-buffer'." 4876 '((display-buffer-reuse-selected-window
4804 (interactive "BPop to buffer in another window:\nP") 4877 display-buffer-same-window)))
4805 (let ((pop-up-windows t) 4878 (window-choice
4806 same-window-buffer-names same-window-regexps) 4879 '(nil (inhibit-same-window . t)))))
4807 (pop-to-buffer buffer-or-name t norecord))) 4880 (window (display-buffer (current-buffer) action))
4808 4881 (frame (window-frame window)))
4809(defun pop-to-buffer-other-frame (&optional buffer-or-name norecord) 4882 (if (eq frame old-frame)
4810 "Pop to buffer specified by BUFFER-OR-NAME on another frame. 4883 ;; Make sure new window gets selected (Bug#8615), (Bug#6954).
4811The selected frame will be used only if there's no other choice. 4884 (select-window window norecord)
4812Optional arguments BUFFER-OR-NAME and NORECORD are as for 4885 ;; If `display-buffer' has chosen another frame, make sure it
4813`pop-to-buffer'." 4886 ;; gets input focus.
4814 (interactive "BPop to buffer on another frame:\nP") 4887 (select-frame-set-input-focus frame norecord))
4815 (let ((pop-up-frames t) 4888 (current-buffer))))
4816 same-window-buffer-names same-window-regexps)
4817 (pop-to-buffer buffer-or-name t norecord)))
4818 4889
4819(defun read-buffer-to-switch (prompt) 4890(defun read-buffer-to-switch (prompt)
4820 "Read the name of a buffer to switch to, prompting with PROMPT. 4891 "Read the name of a buffer to switch to, prompting with PROMPT.