aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-09-10 17:15:28 -0400
committerChong Yidong2011-09-10 17:15:28 -0400
commit3199b96fc585576ffb2ced6542a2bc2d6172f510 (patch)
tree6f74f43a90022b2a0973688356159f9452f38e7d
parent919a69aa0814937507f12851bdd277cb279faf6f (diff)
downloademacs-3199b96fc585576ffb2ced6542a2bc2d6172f510.tar.gz
emacs-3199b96fc585576ffb2ced6542a2bc2d6172f510.zip
Fix various uses of display-buffer and pop-to-buffer
to avoid using special-display-* and same-window-* variables. * lisp/buff-menu.el (Buffer-menu-switch-other-window): Use second arg of display-buffer. (Buffer-menu-2-window): Use switch-to-buffer-other-window. * lisp/replace.el (occur-mode-goto-occurrence) (occur-mode-display-occurrence) Use second arg of pop-to-buffer and display-buffer. * lisp/window.el (display-buffer-alist): Add *Python*. * lisp/mail/reporter.el (reporter-submit-bug-report): Use second arg of display-buffer. * lisp/mail/sendmail.el (sendmail-user-agent-compose): Don't bind the special-display and same-window variables. (mail-other-window): Use switch-to-buffer-other-window. (mail-other-frame): USe switch-to-buffer-other-frame. * lisp/progmodes/gdb-mi.el (gdb-frame-gdb-buffer): Use display-buffer-other-frame. (gdb-display-gdb-buffer): Use pop-to-buffer. * lisp/progmodes/gud.el (gud-goto-info): Use info-other-window. * lisp/progmodes/python.el: Don't set same-window-buffer-names. * lisp/textmodes/bibtex.el (bibtex-search-entry): Use switch-to-buffer.
-rw-r--r--lisp/ChangeLog30
-rw-r--r--lisp/buff-menu.el12
-rw-r--r--lisp/mail/reporter.el9
-rw-r--r--lisp/mail/sendmail.el20
-rw-r--r--lisp/progmodes/compile.el5
-rw-r--r--lisp/progmodes/gdb-mi.el10
-rw-r--r--lisp/progmodes/gud.el17
-rw-r--r--lisp/progmodes/python.el1
-rw-r--r--lisp/replace.el15
-rw-r--r--lisp/textmodes/bibtex.el6
-rw-r--r--lisp/window.el7
11 files changed, 58 insertions, 74 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1a997152194..50ae33a7d6e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,35 @@
12011-09-10 Chong Yidong <cyd@stupidchicken.com> 12011-09-10 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * buff-menu.el (Buffer-menu-switch-other-window): Use second arg
4 of display-buffer.
5 (Buffer-menu-2-window): Use switch-to-buffer-other-window.
6
7 * replace.el (occur-mode-goto-occurrence)
8 (occur-mode-display-occurrence) Use second arg of pop-to-buffer
9 and display-buffer.
10
11 * mail/reporter.el (reporter-submit-bug-report): Use second arg of
12 display-buffer.
13
14 * mail/sendmail.el (sendmail-user-agent-compose): Don't bind the
15 special-display and same-window variables.
16 (mail-other-window): Use switch-to-buffer-other-window.
17 (mail-other-frame): USe switch-to-buffer-other-frame.
18
19 * progmodes/gdb-mi.el (gdb-frame-gdb-buffer): Use
20 display-buffer-other-frame.
21 (gdb-display-gdb-buffer): Use pop-to-buffer.
22
23 * progmodes/gud.el (gud-goto-info): Use info-other-window.
24
25 * progmodes/python.el: Don't set same-window-buffer-names.
26
27 * textmodes/bibtex.el (bibtex-search-entry): Use switch-to-buffer.
28
29 * window.el (display-buffer-alist): Add *Python*.
30
312011-09-10 Chong Yidong <cyd@stupidchicken.com>
32
3 * window.el (display-buffer-alist): Add entry for buffers 33 * window.el (display-buffer-alist): Add entry for buffers
4 previously handled same-window-*. 34 previously handled same-window-*.
5 (display-buffer-alist, display-buffer-default-action) 35 (display-buffer-alist, display-buffer-default-action)
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 2be74cf5efb..d757453c051 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -586,22 +586,16 @@ in the selected frame."
586 "Make the other window select this line's buffer. 586 "Make the other window select this line's buffer.
587The current window remains selected." 587The current window remains selected."
588 (interactive) 588 (interactive)
589 (let ((pop-up-windows t) 589 (display-buffer (Buffer-menu-buffer t) t))
590 same-window-buffer-names
591 same-window-regexps)
592 (display-buffer (Buffer-menu-buffer t))))
593 590
594(defun Buffer-menu-2-window () 591(defun Buffer-menu-2-window ()
595 "Select this line's buffer, with previous buffer in second window." 592 "Select this line's buffer, with previous buffer in second window."
596 (interactive) 593 (interactive)
597 (let ((buff (Buffer-menu-buffer t)) 594 (let ((buff (Buffer-menu-buffer t))
598 (menu (current-buffer)) 595 (menu (current-buffer)))
599 (pop-up-windows t)
600 same-window-buffer-names
601 same-window-regexps)
602 (delete-other-windows) 596 (delete-other-windows)
603 (switch-to-buffer (other-buffer)) 597 (switch-to-buffer (other-buffer))
604 (pop-to-buffer buff) 598 (switch-to-buffer-other-window buff)
605 (bury-buffer menu))) 599 (bury-buffer menu)))
606 600
607(defun Buffer-menu-toggle-read-only () 601(defun Buffer-menu-toggle-read-only ()
diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el
index 45700d4d60d..6c5448aca83 100644
--- a/lisp/mail/reporter.el
+++ b/lisp/mail/reporter.el
@@ -332,12 +332,11 @@ mail-sending package is used for editing and sending the message."
332 hookvar) 332 hookvar)
333 ;; do the work 333 ;; do the work
334 (require 'sendmail) 334 (require 'sendmail)
335 ;; Just in case the original buffer is not visible now, bring it
336 ;; back somewhere
337 (display-buffer reporter-eval-buffer)
335 ;; If mailbuf did not get made visible before, make it visible now. 338 ;; If mailbuf did not get made visible before, make it visible now.
336 (let (same-window-buffer-names same-window-regexps) 339 (pop-to-buffer mailbuf)
337 (pop-to-buffer mailbuf)
338 ;; Just in case the original buffer is not visible now, bring it
339 ;; back somewhere
340 (and pop-up-windows (display-buffer reporter-eval-buffer)))
341 (goto-char (point-min)) 340 (goto-char (point-min))
342 (mail-position-on-field "to") 341 (mail-position-on-field "to")
343 (insert address) 342 (insert address)
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 4dc96176256..6e5c9a6b257 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -565,11 +565,7 @@ To change your decision later, customize `send-mail-function'.\n")
565 send-actions return-action 565 send-actions return-action
566 &rest ignored) 566 &rest ignored)
567 (if switch-function 567 (if switch-function
568 (let ((special-display-buffer-names nil) 568 (funcall switch-function "*mail*"))
569 (special-display-regexps nil)
570 (same-window-buffer-names nil)
571 (same-window-regexps nil))
572 (funcall switch-function "*mail*")))
573 (let ((cc (cdr (assoc-string "cc" other-headers t))) 569 (let ((cc (cdr (assoc-string "cc" other-headers t)))
574 (in-reply-to (cdr (assoc-string "in-reply-to" other-headers t))) 570 (in-reply-to (cdr (assoc-string "in-reply-to" other-headers t)))
575 (body (cdr (assoc-string "body" other-headers t)))) 571 (body (cdr (assoc-string "body" other-headers t))))
@@ -1966,24 +1962,14 @@ you can move to one of them and type C-c C-c to recover that one."
1966(defun mail-other-window (&optional noerase to subject in-reply-to cc replybuffer sendactions) 1962(defun mail-other-window (&optional noerase to subject in-reply-to cc replybuffer sendactions)
1967 "Like `mail' command, but display mail buffer in another window." 1963 "Like `mail' command, but display mail buffer in another window."
1968 (interactive "P") 1964 (interactive "P")
1969 (let ((pop-up-windows t) 1965 (switch-to-buffer-other-window "*mail*")
1970 (special-display-buffer-names nil)
1971 (special-display-regexps nil)
1972 (same-window-buffer-names nil)
1973 (same-window-regexps nil))
1974 (pop-to-buffer "*mail*"))
1975 (mail noerase to subject in-reply-to cc replybuffer sendactions)) 1966 (mail noerase to subject in-reply-to cc replybuffer sendactions))
1976 1967
1977;;;###autoload 1968;;;###autoload
1978(defun mail-other-frame (&optional noerase to subject in-reply-to cc replybuffer sendactions) 1969(defun mail-other-frame (&optional noerase to subject in-reply-to cc replybuffer sendactions)
1979 "Like `mail' command, but display mail buffer in another frame." 1970 "Like `mail' command, but display mail buffer in another frame."
1980 (interactive "P") 1971 (interactive "P")
1981 (let ((pop-up-frames t) 1972 (switch-to-buffer-other-frame "*mail*")
1982 (special-display-buffer-names nil)
1983 (special-display-regexps nil)
1984 (same-window-buffer-names nil)
1985 (same-window-regexps nil))
1986 (pop-to-buffer "*mail*"))
1987 (mail noerase to subject in-reply-to cc replybuffer sendactions)) 1973 (mail noerase to subject in-reply-to cc replybuffer sendactions))
1988 1974
1989;; Do not add anything but external entries on this page. 1975;; Do not add anything but external entries on this page.
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index cd891a8df60..619c423902c 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -2408,9 +2408,8 @@ and overlay is highlighted between MK and END-MK."
2408 ;; also do this while we change buffer 2408 ;; also do this while we change buffer
2409 (compilation-set-window w msg) 2409 (compilation-set-window w msg)
2410 compilation-highlight-regexp))) 2410 compilation-highlight-regexp)))
2411 ;; Ideally, the window-size should be passed to `display-buffer' (via 2411 ;; Ideally, the window-size should be passed to `display-buffer'
2412 ;; something like special-display-buffer) so it's only used when 2412 ;; so it's only used when creating a new window.
2413 ;; creating a new window.
2414 (unless pre-existing (compilation-set-window-height w)) 2413 (unless pre-existing (compilation-set-window-height w))
2415 2414
2416 (if from-compilation-buffer 2415 (if from-compilation-buffer
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 87209a78ffb..d55a9eed3f0 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -3980,18 +3980,12 @@ SPLIT-HORIZONTAL and show BUF in the new window."
3980(defun gdb-frame-gdb-buffer () 3980(defun gdb-frame-gdb-buffer ()
3981 "Display GUD buffer in a new frame." 3981 "Display GUD buffer in a new frame."
3982 (interactive) 3982 (interactive)
3983 (let ((special-display-regexps (append special-display-regexps '(".*"))) 3983 (display-buffer-other-frame gud-comint-buffer))
3984 (special-display-frame-alist
3985 (remove '(menu-bar-lines) (remove '(tool-bar-lines)
3986 gdb-frame-parameters)))
3987 (same-window-regexps nil))
3988 (display-buffer gud-comint-buffer)))
3989 3984
3990(defun gdb-display-gdb-buffer () 3985(defun gdb-display-gdb-buffer ()
3991 "Display GUD buffer." 3986 "Display GUD buffer."
3992 (interactive) 3987 (interactive)
3993 (let ((same-window-regexps nil)) 3988 (pop-to-buffer gud-comint-buffer nil 0))
3994 (select-window (display-buffer gud-comint-buffer nil 0))))
3995 3989
3996(defun gdb-set-window-buffer (name &optional ignore-dedicated window) 3990(defun gdb-set-window-buffer (name &optional ignore-dedicated window)
3997 "Set buffer of selected window to NAME and dedicate window. 3991 "Set buffer of selected window to NAME and dedicate window.
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 3c7addee3b8..534082544b6 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -112,20 +112,9 @@ Used to grey out relevant toolbar icons.")
112(defun gud-goto-info () 112(defun gud-goto-info ()
113 "Go to relevant Emacs info node." 113 "Go to relevant Emacs info node."
114 (interactive) 114 (interactive)
115 (let ((same-window-regexps same-window-regexps) 115 (if (eq gud-minor-mode 'gdbmi)
116 (display-buffer-reuse-frames t)) 116 (info-other-window "(emacs)GDB Graphical Interface")
117 (catch 'info-found 117 (info-other-window "(emacs)Debuggers")))
118 (walk-windows
119 (lambda (window)
120 (if (eq (window-buffer window) (get-buffer "*info*"))
121 (progn
122 (setq same-window-regexps nil)
123 (throw 'info-found nil))))
124 nil 0)
125 (select-frame (make-frame)))
126 (if (eq gud-minor-mode 'gdbmi)
127 (info "(emacs)GDB Graphical Interface")
128 (info "(emacs)Debuggers"))))
129 118
130(defun gud-tool-bar-item-visible-no-fringe () 119(defun gud-tool-bar-item-visible-no-fringe ()
131 (not (or (eq (buffer-local-value 'major-mode (window-buffer)) 'speedbar-mode) 120 (not (or (eq (buffer-local-value 'major-mode (window-buffer)) 'speedbar-mode)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 3f923f496b9..38bf9552b2a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -86,7 +86,6 @@
86(add-to-list 'interpreter-mode-alist (cons (purecopy "python") 'python-mode)) 86(add-to-list 'interpreter-mode-alist (cons (purecopy "python") 'python-mode))
87;;;###autoload 87;;;###autoload
88(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) 88(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode))
89(add-to-list 'same-window-buffer-names (purecopy "*Python*"))
90 89
91;;;; Font lock 90;;;; Font lock
92 91
diff --git a/lisp/replace.el b/lisp/replace.el
index fb98a714dff..ee430fd9855 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -928,7 +928,7 @@ To return to ordinary Occur mode, use \\[occur-mode]."
928 928
929(defalias 'occur-mode-mouse-goto 'occur-mode-goto-occurrence) 929(defalias 'occur-mode-mouse-goto 'occur-mode-goto-occurrence)
930(defun occur-mode-goto-occurrence (&optional event) 930(defun occur-mode-goto-occurrence (&optional event)
931 "Go to the occurrence the current line describes." 931 "Go to the occurrence on the current line."
932 (interactive (list last-nonmenu-event)) 932 (interactive (list last-nonmenu-event))
933 (let ((pos 933 (let ((pos
934 (if (null event) 934 (if (null event)
@@ -939,10 +939,8 @@ To return to ordinary Occur mode, use \\[occur-mode]."
939 (with-current-buffer (window-buffer (posn-window (event-end event))) 939 (with-current-buffer (window-buffer (posn-window (event-end event)))
940 (save-excursion 940 (save-excursion
941 (goto-char (posn-point (event-end event))) 941 (goto-char (posn-point (event-end event)))
942 (occur-mode-find-occurrence))))) 942 (occur-mode-find-occurrence))))))
943 same-window-buffer-names 943 (pop-to-buffer (marker-buffer pos) t)
944 same-window-regexps)
945 (pop-to-buffer (marker-buffer pos))
946 (goto-char pos) 944 (goto-char pos)
947 (run-hooks 'occur-mode-find-occurrence-hook))) 945 (run-hooks 'occur-mode-find-occurrence-hook)))
948 946
@@ -958,11 +956,8 @@ To return to ordinary Occur mode, use \\[occur-mode]."
958 "Display in another window the occurrence the current line describes." 956 "Display in another window the occurrence the current line describes."
959 (interactive) 957 (interactive)
960 (let ((pos (occur-mode-find-occurrence)) 958 (let ((pos (occur-mode-find-occurrence))
961 window 959 window)
962 ;; Bind these to ensure `display-buffer' puts it in another window. 960 (setq window (display-buffer (marker-buffer pos) t))
963 same-window-buffer-names
964 same-window-regexps)
965 (setq window (display-buffer (marker-buffer pos)))
966 ;; This is the way to set point in the proper window. 961 ;; This is the way to set point in the proper window.
967 (save-selected-window 962 (save-selected-window
968 (select-window window) 963 (select-window window)
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 0383251523f..3efb2f158c0 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -4038,10 +4038,8 @@ A prefix arg negates the value of `bibtex-search-entry-globally'."
4038 ;; `bibtex-search-entry' moves point if key found 4038 ;; `bibtex-search-entry' moves point if key found
4039 (setq found (bibtex-search-entry key))))) 4039 (setq found (bibtex-search-entry key)))))
4040 (cond ((and found display) 4040 (cond ((and found display)
4041 (let ((same-window-buffer-names 4041 (switch-to-buffer buffer)
4042 (cons (buffer-name buffer) same-window-buffer-names))) 4042 (bibtex-reposition-window))
4043 (pop-to-buffer buffer)
4044 (bibtex-reposition-window)))
4045 (found (set-buffer buffer)) 4043 (found (set-buffer buffer))
4046 (display (message "Key `%s' not found" key))) 4044 (display (message "Key `%s' not found" key)))
4047 found) 4045 found)
diff --git a/lisp/window.el b/lisp/window.el
index 2afd608907d..72cad635ab5 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4499,8 +4499,9 @@ BUFFER-OR-NAME and return that buffer."
4499 (current-buffer))) 4499 (current-buffer)))
4500 4500
4501(defvar display-buffer-alist 4501(defvar display-buffer-alist
4502 '(("\\`\\*\\(scheme\\|ielm\\|shell\\|\\(unsent \\)?mail\\|inferior-lisp\ 4502 '(("\\`\\*\\(scheme\\|ielm\\|shell\\|\\(unsent \\)?mail\\|\
4503\\|Customiz.*\\|info\\|rlogin-.*\\|telnet-.*\\|rsh-.*\\|gud-.*\\)\\*\\(<[0-9]+>\\)?" 4503inferior-lisp\\|Python\\|Customiz.*\\|info\\|rlogin-.*\\|\
4504telnet-.*\\|rsh-.*\\|gud-.*\\)\\*\\(<[0-9]+>\\)?"
4504 . (display-buffer-same-window))) 4505 . (display-buffer-same-window)))
4505 "Alist of conditional actions for `display-buffer'. 4506 "Alist of conditional actions for `display-buffer'.
4506This is a list of elements (CONDITION . ACTION), where: 4507This is a list of elements (CONDITION . ACTION), where:
@@ -4565,7 +4566,7 @@ the same form as ALIST. See `display-buffer' for details.")
4565(put 'display-buffer--other-frame-action 'risky-local-variable t) 4566(put 'display-buffer--other-frame-action 'risky-local-variable t)
4566 4567
4567(defun display-buffer (&optional buffer-or-name action frame) 4568(defun display-buffer (&optional buffer-or-name action frame)
4568 "Display BUFFER-OR-NAME in some window. 4569 "Display BUFFER-OR-NAME in some window, without selecting it.
4569BUFFER-OR-NAME must be a buffer or the name of an existing 4570BUFFER-OR-NAME must be a buffer or the name of an existing
4570buffer. Return the window chosen for displaying BUFFER-OR-NAME, 4571buffer. Return the window chosen for displaying BUFFER-OR-NAME,
4571or nil if no such window is found. 4572or nil if no such window is found.