emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105709: Fix various uses of display-


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105709: Fix various uses of display-buffer and pop-to-buffer
Date: Sat, 10 Sep 2011 17:15:28 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105709
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2011-09-10 17:15:28 -0400
message:
  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.
modified:
  lisp/ChangeLog
  lisp/buff-menu.el
  lisp/mail/reporter.el
  lisp/mail/sendmail.el
  lisp/progmodes/compile.el
  lisp/progmodes/gdb-mi.el
  lisp/progmodes/gud.el
  lisp/progmodes/python.el
  lisp/replace.el
  lisp/textmodes/bibtex.el
  lisp/window.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-09-10 20:14:02 +0000
+++ b/lisp/ChangeLog    2011-09-10 21:15:28 +0000
@@ -1,5 +1,35 @@
 2011-09-10  Chong Yidong  <address@hidden>
 
+       * buff-menu.el (Buffer-menu-switch-other-window): Use second arg
+       of display-buffer.
+       (Buffer-menu-2-window): Use switch-to-buffer-other-window.
+
+       * replace.el (occur-mode-goto-occurrence)
+       (occur-mode-display-occurrence) Use second arg of pop-to-buffer
+       and display-buffer.
+
+       * mail/reporter.el (reporter-submit-bug-report): Use second arg of
+       display-buffer.
+
+       * 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.
+
+       * progmodes/gdb-mi.el (gdb-frame-gdb-buffer): Use
+       display-buffer-other-frame.
+       (gdb-display-gdb-buffer): Use pop-to-buffer.
+
+       * progmodes/gud.el (gud-goto-info): Use info-other-window.
+
+       * progmodes/python.el: Don't set same-window-buffer-names.
+
+       * textmodes/bibtex.el (bibtex-search-entry): Use switch-to-buffer.
+
+       * window.el (display-buffer-alist): Add *Python*.
+
+2011-09-10  Chong Yidong  <address@hidden>
+
        * window.el (display-buffer-alist): Add entry for buffers
        previously handled same-window-*.
        (display-buffer-alist, display-buffer-default-action)

=== modified file 'lisp/buff-menu.el'
--- a/lisp/buff-menu.el 2011-08-25 10:45:33 +0000
+++ b/lisp/buff-menu.el 2011-09-10 21:15:28 +0000
@@ -586,22 +586,16 @@
   "Make the other window select this line's buffer.
 The current window remains selected."
   (interactive)
-  (let ((pop-up-windows t)
-       same-window-buffer-names
-       same-window-regexps)
-    (display-buffer (Buffer-menu-buffer t))))
+  (display-buffer (Buffer-menu-buffer t) t))
 
 (defun Buffer-menu-2-window ()
   "Select this line's buffer, with previous buffer in second window."
   (interactive)
   (let ((buff (Buffer-menu-buffer t))
-       (menu (current-buffer))
-       (pop-up-windows t)
-       same-window-buffer-names
-       same-window-regexps)
+       (menu (current-buffer)))
     (delete-other-windows)
     (switch-to-buffer (other-buffer))
-    (pop-to-buffer buff)
+    (switch-to-buffer-other-window buff)
     (bury-buffer menu)))
 
 (defun Buffer-menu-toggle-read-only ()

=== modified file 'lisp/mail/reporter.el'
--- a/lisp/mail/reporter.el     2011-01-25 04:08:28 +0000
+++ b/lisp/mail/reporter.el     2011-09-10 21:15:28 +0000
@@ -332,12 +332,11 @@
        hookvar)
     ;; do the work
     (require 'sendmail)
+    ;; Just in case the original buffer is not visible now, bring it
+    ;; back somewhere
+    (display-buffer reporter-eval-buffer)
     ;; If mailbuf did not get made visible before, make it visible now.
-    (let (same-window-buffer-names same-window-regexps)
-      (pop-to-buffer mailbuf)
-      ;; Just in case the original buffer is not visible now, bring it
-      ;; back somewhere
-      (and pop-up-windows (display-buffer reporter-eval-buffer)))
+    (pop-to-buffer mailbuf)
     (goto-char (point-min))
     (mail-position-on-field "to")
     (insert address)

=== modified file 'lisp/mail/sendmail.el'
--- a/lisp/mail/sendmail.el     2011-09-10 18:52:37 +0000
+++ b/lisp/mail/sendmail.el     2011-09-10 21:15:28 +0000
@@ -565,11 +565,7 @@
                                    send-actions return-action
                                    &rest ignored)
   (if switch-function
-      (let ((special-display-buffer-names nil)
-           (special-display-regexps nil)
-           (same-window-buffer-names nil)
-           (same-window-regexps nil))
-       (funcall switch-function "*mail*")))
+      (funcall switch-function "*mail*"))
   (let ((cc (cdr (assoc-string "cc" other-headers t)))
        (in-reply-to (cdr (assoc-string "in-reply-to" other-headers t)))
        (body (cdr (assoc-string "body" other-headers t))))
@@ -1966,24 +1962,14 @@
 (defun mail-other-window (&optional noerase to subject in-reply-to cc 
replybuffer sendactions)
   "Like `mail' command, but display mail buffer in another window."
   (interactive "P")
-  (let ((pop-up-windows t)
-       (special-display-buffer-names nil)
-       (special-display-regexps nil)
-       (same-window-buffer-names nil)
-       (same-window-regexps nil))
-    (pop-to-buffer "*mail*"))
+  (switch-to-buffer-other-window "*mail*")
   (mail noerase to subject in-reply-to cc replybuffer sendactions))
 
 ;;;###autoload
 (defun mail-other-frame (&optional noerase to subject in-reply-to cc 
replybuffer sendactions)
   "Like `mail' command, but display mail buffer in another frame."
   (interactive "P")
-  (let ((pop-up-frames t)
-       (special-display-buffer-names nil)
-       (special-display-regexps nil)
-       (same-window-buffer-names nil)
-       (same-window-regexps nil))
-    (pop-to-buffer "*mail*"))
+  (switch-to-buffer-other-frame "*mail*")
   (mail noerase to subject in-reply-to cc replybuffer sendactions))
 
 ;; Do not add anything but external entries on this page.

=== modified file 'lisp/progmodes/compile.el'
--- a/lisp/progmodes/compile.el 2011-09-08 12:12:18 +0000
+++ b/lisp/progmodes/compile.el 2011-09-10 21:15:28 +0000
@@ -2408,9 +2408,8 @@
                             ;; also do this while we change buffer
                             (compilation-set-window w msg)
                             compilation-highlight-regexp)))
-    ;; Ideally, the window-size should be passed to `display-buffer' (via
-    ;; something like special-display-buffer) so it's only used when
-    ;; creating a new window.
+    ;; Ideally, the window-size should be passed to `display-buffer'
+    ;; so it's only used when creating a new window.
     (unless pre-existing (compilation-set-window-height w))
 
     (if from-compilation-buffer

=== modified file 'lisp/progmodes/gdb-mi.el'
--- a/lisp/progmodes/gdb-mi.el  2011-07-05 18:58:33 +0000
+++ b/lisp/progmodes/gdb-mi.el  2011-09-10 21:15:28 +0000
@@ -3980,18 +3980,12 @@
 (defun gdb-frame-gdb-buffer ()
   "Display GUD buffer in a new frame."
   (interactive)
-  (let ((special-display-regexps (append special-display-regexps '(".*")))
-       (special-display-frame-alist
-        (remove '(menu-bar-lines) (remove '(tool-bar-lines)
-                                          gdb-frame-parameters)))
-       (same-window-regexps nil))
-    (display-buffer gud-comint-buffer)))
+  (display-buffer-other-frame gud-comint-buffer))
 
 (defun gdb-display-gdb-buffer ()
   "Display GUD buffer."
   (interactive)
-  (let ((same-window-regexps nil))
-    (select-window (display-buffer gud-comint-buffer nil 0))))
+  (pop-to-buffer gud-comint-buffer nil 0))
 
 (defun gdb-set-window-buffer (name &optional ignore-dedicated window)
   "Set buffer of selected window to NAME and dedicate window.

=== modified file 'lisp/progmodes/gud.el'
--- a/lisp/progmodes/gud.el     2011-09-10 18:52:37 +0000
+++ b/lisp/progmodes/gud.el     2011-09-10 21:15:28 +0000
@@ -112,20 +112,9 @@
 (defun gud-goto-info ()
   "Go to relevant Emacs info node."
   (interactive)
-  (let ((same-window-regexps same-window-regexps)
-       (display-buffer-reuse-frames t))
-    (catch 'info-found
-      (walk-windows
-       (lambda (window)
-         (if (eq (window-buffer window) (get-buffer "*info*"))
-             (progn
-               (setq same-window-regexps nil)
-               (throw 'info-found nil))))
-       nil 0)
-      (select-frame (make-frame)))
-    (if (eq gud-minor-mode 'gdbmi)
-       (info "(emacs)GDB Graphical Interface")
-      (info "(emacs)Debuggers"))))
+  (if (eq gud-minor-mode 'gdbmi)
+      (info-other-window "(emacs)GDB Graphical Interface")
+    (info-other-window "(emacs)Debuggers")))
 
 (defun gud-tool-bar-item-visible-no-fringe ()
   (not (or (eq (buffer-local-value 'major-mode (window-buffer)) 'speedbar-mode)

=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el  2011-09-03 18:44:37 +0000
+++ b/lisp/progmodes/python.el  2011-09-10 21:15:28 +0000
@@ -86,7 +86,6 @@
 (add-to-list 'interpreter-mode-alist (cons (purecopy "python") 'python-mode))
 ;;;###autoload
 (add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'")  'python-mode))
-(add-to-list 'same-window-buffer-names (purecopy "*Python*"))
 
 ;;;; Font lock
 

=== modified file 'lisp/replace.el'
--- a/lisp/replace.el   2011-07-02 13:53:53 +0000
+++ b/lisp/replace.el   2011-09-10 21:15:28 +0000
@@ -928,7 +928,7 @@
 
 (defalias 'occur-mode-mouse-goto 'occur-mode-goto-occurrence)
 (defun occur-mode-goto-occurrence (&optional event)
-  "Go to the occurrence the current line describes."
+  "Go to the occurrence on the current line."
   (interactive (list last-nonmenu-event))
   (let ((pos
          (if (null event)
@@ -939,10 +939,8 @@
            (with-current-buffer (window-buffer (posn-window (event-end event)))
              (save-excursion
                (goto-char (posn-point (event-end event)))
-               (occur-mode-find-occurrence)))))
-        same-window-buffer-names
-        same-window-regexps)
-    (pop-to-buffer (marker-buffer pos))
+               (occur-mode-find-occurrence))))))
+    (pop-to-buffer (marker-buffer pos) t)
     (goto-char pos)
     (run-hooks 'occur-mode-find-occurrence-hook)))
 
@@ -958,11 +956,8 @@
   "Display in another window the occurrence the current line describes."
   (interactive)
   (let ((pos (occur-mode-find-occurrence))
-       window
-       ;; Bind these to ensure `display-buffer' puts it in another window.
-       same-window-buffer-names
-       same-window-regexps)
-    (setq window (display-buffer (marker-buffer pos)))
+       window)
+    (setq window (display-buffer (marker-buffer pos) t))
     ;; This is the way to set point in the proper window.
     (save-selected-window
       (select-window window)

=== modified file 'lisp/textmodes/bibtex.el'
--- a/lisp/textmodes/bibtex.el  2011-09-02 16:38:40 +0000
+++ b/lisp/textmodes/bibtex.el  2011-09-10 21:15:28 +0000
@@ -4038,10 +4038,8 @@
                 ;; `bibtex-search-entry' moves point if key found
                 (setq found (bibtex-search-entry key)))))
         (cond ((and found display)
-               (let ((same-window-buffer-names
-                      (cons (buffer-name buffer) same-window-buffer-names)))
-                 (pop-to-buffer buffer)
-                 (bibtex-reposition-window)))
+              (switch-to-buffer buffer)
+              (bibtex-reposition-window))
               (found (set-buffer buffer))
               (display (message "Key `%s' not found" key)))
         found)

=== modified file 'lisp/window.el'
--- a/lisp/window.el    2011-09-10 19:31:05 +0000
+++ b/lisp/window.el    2011-09-10 21:15:28 +0000
@@ -4499,8 +4499,9 @@
     (current-buffer)))
 
 (defvar display-buffer-alist
-  '(("\\`\\*\\(scheme\\|ielm\\|shell\\|\\(unsent \\)?mail\\|inferior-lisp\
-\\|Customiz.*\\|info\\|rlogin-.*\\|telnet-.*\\|rsh-.*\\|gud-.*\\)\\*\\(<[0-9]+>\\)?"
+  '(("\\`\\*\\(scheme\\|ielm\\|shell\\|\\(unsent \\)?mail\\|\
+inferior-lisp\\|Python\\|Customiz.*\\|info\\|rlogin-.*\\|\
+telnet-.*\\|rsh-.*\\|gud-.*\\)\\*\\(<[0-9]+>\\)?"
      . (display-buffer-same-window)))
   "Alist of conditional actions for `display-buffer'.
 This is a list of elements (CONDITION . ACTION), where:
@@ -4565,7 +4566,7 @@
 (put 'display-buffer--other-frame-action 'risky-local-variable t)
 
 (defun display-buffer (&optional buffer-or-name action frame)
-  "Display BUFFER-OR-NAME in some window.
+  "Display BUFFER-OR-NAME in some window, without selecting it.
 BUFFER-OR-NAME must be a buffer or the name of an existing
 buffer.  Return the window chosen for displaying BUFFER-OR-NAME,
 or nil if no such window is found.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]