]> git.eshelyaron.com Git - emacs.git/commitdiff
Rewrite more functions with buffer display specifiers
authorMartin Rudalics <rudalics@gmx.at>
Sun, 7 Nov 2010 19:47:18 +0000 (20:47 +0100)
committerMartin Rudalics <rudalics@gmx.at>
Sun, 7 Nov 2010 19:47:18 +0000 (20:47 +0100)
* printing.el (pr-file-list): Comment out bindings of
pop-up-windows and pop-up-frames.

* mail/reporter.el (reporter-submit-bug-report): Use
pop-to-buffer-other-window and display specifiers.

* mail/sendmail.el (mail-bury): Do something similar to
quit-restore-window.
(top-level): Don't change same-window-buffer-names via add-hook
any more.
(mail): Use pop-to-buffer-same-window.
(mail-other-window): Use pop-to-buffer-other-window.
(mail-other-frame): Use pop-to-buffer-other-frame.

* simple.el (display-message-or-buffer): Rename argument FRAME
to IGNORE because it's ignored.  Change call to display-buffer
accordingly.
(sendmail-user-agent-compose): Remove let bindings around call
to switch-function; the latter should have been bound to an
appropriate function already.
(clone-buffer): Call pop-to-buffer-other-window.
(clone-indirect-buffer): New semantices of display-flag
argument.
(clone-indirect-buffer-other-window): Interactively set
display-flag to 'other-window.

* calendar/solar.el (sunrise-sunset): Use with-help-window instead
of with-output-to-temp-buffer.

* textmodes/bibtex.el (bibtex-search-entry): Use
pop-to-buffer-same-window.

* cmuscheme.el (run-scheme): Use pop-to-buffer-same-window.
(top-level): Remove autoloaded add-hook for
same-window-buffer-names.

* eshell/eshell.el (eshell-add-to-window-buffer-names)
(eshell-remove-from-window-buffer-names): Remove.
(eshell-unload-hook): Don't call
eshell-remove-from-window-buffer-names.
(eshell-buffer-name): Don't call
eshell-remove-from-window-buffer-names and
eshell-add-to-window-buffer-names.
(top-level): Remove eshell-deftest call to check for
same-window-buffer-names.
(eshell): Call pop-to-buffer-same-window.

* files.el (display-buffer-other-frame): Remove.

* ielm.el (top-level): Remove autoloaded add-hook for
same-window-buffer-names.
(ielm): Use pop-to-buffer-same-window.

* progmodes/inf-lisp.el (inferior-lisp): Use
pop-to-buffer-same-window.
(top-level): Remove autoloaded add-hook for
same-window-buffer-names.
(switch-to-lisp): Use pop-to-buffer with tailored specifiers.

* replace.el (occur-mode-goto-occurrence): Use
pop-to-buffer-other-window.
(occur-mode-display-occurrence): Use
display-buffer-other-window.

* shell.el (shell): Use pop-to-buffer-same-window.
(top-level): Remove autoloaded add-hook for
same-window-buffer-names.

* net/rlogin.el: (top-level): Remove autoloaded add-hook for
same-window-regexps.
(rlogin): Use pop-to-buffer-same-window.

* net/telnet.el (top-level): Remove two autoloaded add-hooks for
same-window-regexps.
(telnet, rsh): Use pop-to-buffer-same-window.

16 files changed:
lisp/ChangeLog
lisp/calendar/solar.el
lisp/cmuscheme.el
lisp/eshell/eshell.el
lisp/files.el
lisp/ielm.el
lisp/mail/reporter.el
lisp/mail/sendmail.el
lisp/net/rlogin.el
lisp/net/telnet.el
lisp/printing.el
lisp/progmodes/inf-lisp.el
lisp/replace.el
lisp/shell.el
lisp/simple.el
lisp/textmodes/bibtex.el

index 0019e06e717503a2863021fef221b2d44f66d4ed..e0ae662f3eca7835d16cde4aeae8ec1b4524fbdf 100644 (file)
@@ -1,3 +1,77 @@
+2010-11-07  Martin Rudalics  <rudalics@gmx.at>
+
+       * ielm.el (top-level): Remove autoloaded add-hook for
+       same-window-buffer-names.
+       (ielm): Use pop-to-buffer-same-window.
+
+       * progmodes/inf-lisp.el (inferior-lisp): Use
+       pop-to-buffer-same-window.
+       (top-level): Remove autoloaded add-hook for
+       same-window-buffer-names.
+       (switch-to-lisp): Use pop-to-buffer with tailored specifiers.
+
+       * replace.el (occur-mode-goto-occurrence): Use
+       pop-to-buffer-other-window.
+       (occur-mode-display-occurrence): Use
+       display-buffer-other-window.
+
+       * shell.el (shell): Use pop-to-buffer-same-window.
+       (top-level): Remove autoloaded add-hook for
+       same-window-buffer-names.
+
+       * net/rlogin.el: (top-level): Remove autoloaded add-hook for
+       same-window-regexps.
+       (rlogin): Use pop-to-buffer-same-window.
+
+       * net/telnet.el (top-level): Remove two autoloaded add-hooks for
+       same-window-regexps.
+       (telnet, rsh): Use pop-to-buffer-same-window.
+
+2010-11-06  Martin Rudalics  <rudalics@gmx.at>
+
+       * mail/sendmail.el (mail-bury): Do something similar to
+       quit-restore-window.
+       (top-level): Don't change same-window-buffer-names via add-hook
+       any more.
+       (mail): Use pop-to-buffer-same-window.
+       (mail-other-window): Use pop-to-buffer-other-window.
+       (mail-other-frame): Use pop-to-buffer-other-frame.
+
+       * simple.el (display-message-or-buffer): Rename argument FRAME
+       to IGNORE because it's ignored.  Change call to display-buffer
+       accordingly.
+       (sendmail-user-agent-compose): Remove let bindings around call
+       to switch-function; the latter should have been bound to an
+       appropriate function already.
+       (clone-buffer): Call pop-to-buffer-other-window.
+       (clone-indirect-buffer): New semantices of display-flag
+       argument.
+       (clone-indirect-buffer-other-window): Interactively set
+       display-flag to 'other-window.
+
+       * calendar/solar.el (sunrise-sunset): Use with-help-window instead
+       of with-output-to-temp-buffer.
+
+       * textmodes/bibtex.el (bibtex-search-entry): Use
+       pop-to-buffer-same-window.
+
+       * cmuscheme.el (run-scheme): Use pop-to-buffer-same-window.
+       (top-level): Remove autoloaded add-hook for
+       same-window-buffer-names.
+
+       * eshell/eshell.el (eshell-add-to-window-buffer-names)
+       (eshell-remove-from-window-buffer-names): Remove.
+       (eshell-unload-hook): Don't call
+       eshell-remove-from-window-buffer-names.
+       (eshell-buffer-name): Don't call
+       eshell-remove-from-window-buffer-names and
+       eshell-add-to-window-buffer-names.
+       (top-level): Remove eshell-deftest call to check for
+       same-window-buffer-names.
+       (eshell): Call pop-to-buffer-same-window.
+
+       * files.el (display-buffer-other-frame): Remove.
+
 2010-11-05  Martin Rudalics  <rudalics@gmx.at>
 
        * window.el (display-buffer-even-sizes)
        * vc/pcvs-util.el (cvs-pop-to-buffer-same-frame): Use buffer
        display specifiers.
 
+       * printing.el (pr-file-list): Comment out bindings of
+       pop-up-windows and pop-up-frames.
+
+       * mail/reporter.el (reporter-submit-bug-report): Use
+       pop-to-buffer-other-window and display specifiers.
+
 2010-11-04  Martin Rudalics  <rudalics@gmx.at>
 
        * window.el (display-buffer-names, display-buffer-regexps): Make
index b7a728461f0884dd38fa1e29e4d399a2fc15c007..11d4c2c3f6fe0ffb1025317413418dc181ba9d46 100644 (file)
@@ -855,16 +855,8 @@ This function is suitable for execution in a .emacs file."
          (one-window (one-window-p t)))
     (if (<= (length msg) (frame-width))
         (message "%s" msg)
-      (with-output-to-temp-buffer "*temp*"
-        (princ (concat date-string "\n" time-string)))
-      (message "%s"
-               (substitute-command-keys
-                (if one-window
-                    (if pop-up-windows
-                        "Type \\[delete-other-windows] to remove temp window."
-                      "Type \\[switch-to-buffer] RET to remove temp window.")
-                  "Type \\[switch-to-buffer-other-window] RET to restore old \
-contents of temp window."))))))
+      (with-help-window "*temp*"
+        (princ (concat date-string "\n" time-string))))))
 
 ;;;###cal-autoload
 (defun calendar-sunrise-sunset (&optional event)
index 9cf5356fa67b96a59276095c0b90691ec50422b1..97b6829b30edbdcf83d2bce1b09f39226d042599 100644 (file)
@@ -247,8 +247,7 @@ is run).
        (inferior-scheme-mode)))
   (setq scheme-program-name cmd)
   (setq scheme-buffer "*scheme*")
-  (pop-to-buffer "*scheme*"))
-;;;###autoload (add-hook 'same-window-buffer-names (purecopy "*scheme*"))
+  (pop-to-buffer-same-window "*scheme*"))
 
 (defun scheme-start-file (prog)
   "Return the name of the start file corresponding to PROG.
index 89ec3ab9c601c97592fbdfa81f911171a3d73e88..eaa0d1a3b0e17c93e80748a11c3d3ceae77123a8 100644 (file)
@@ -247,23 +247,13 @@ shells such as bash, zsh, rc, 4dos."
 ;; The following user options modify the behavior of Eshell overall.
 (defvar eshell-buffer-name)
 
-(defsubst eshell-add-to-window-buffer-names ()
-  "Add `eshell-buffer-name' to `same-window-buffer-names'."
-  (add-to-list 'same-window-buffer-names eshell-buffer-name))
-
-(defsubst eshell-remove-from-window-buffer-names ()
-  "Remove `eshell-buffer-name' from `same-window-buffer-names'."
-  (setq same-window-buffer-names
-       (delete eshell-buffer-name same-window-buffer-names)))
-
 (defcustom eshell-load-hook nil
   "A hook run once Eshell has been loaded."
   :type 'hook
   :group 'eshell)
 
 (defcustom eshell-unload-hook
-  '(eshell-remove-from-window-buffer-names
-    eshell-unload-all-modules)
+  '(eshell-unload-all-modules)
   "A hook run when Eshell is unloaded from memory."
   :type 'hook
   :group 'eshell)
@@ -272,19 +262,12 @@ shells such as bash, zsh, rc, 4dos."
   "The basename used for Eshell buffers."
   :set (lambda (symbol value)
         ;; remove the old value of `eshell-buffer-name', if present
-        (if (boundp 'eshell-buffer-name)
-            (eshell-remove-from-window-buffer-names))
         (set symbol value)
         ;; add the new value
-        (eshell-add-to-window-buffer-names)
         value)
   :type 'string
   :group 'eshell)
 
-(eshell-deftest mode same-window-buffer-names
-  "`eshell-buffer-name' is a member of `same-window-buffer-names'"
-  (member eshell-buffer-name same-window-buffer-names))
-
 (defcustom eshell-directory-name (convert-standard-filename "~/.eshell/")
   "The directory where Eshell control files should be kept."
   :type 'directory
@@ -326,13 +309,8 @@ buffer selected (or created)."
                    (generate-new-buffer eshell-buffer-name))
                   (t
                    (get-buffer-create eshell-buffer-name)))))
-    ;; Simply calling `pop-to-buffer' will not mimic the way that
-    ;; shell-mode buffers appear, since they always reuse the same
-    ;; window that that command was invoked from.  To achieve this,
-    ;; it's necessary to add `eshell-buffer-name' to the variable
-    ;; `same-window-buffer-names', which is done when Eshell is loaded
     (assert (and buf (buffer-live-p buf)))
-    (pop-to-buffer buf)
+    (pop-to-buffer-same-window buf)
     (unless (eq major-mode 'eshell-mode)
       (eshell-mode))
     buf))
index 6a7a9b09a4862d3a14a90477f6cd513316ee3aac..72444b70aca59eb373f0bf73bf8b69b65a15e753 100644 (file)
@@ -1241,29 +1241,6 @@ return value, which may be passed as the REQUIRE-MATCH arg to
         'confirm)
        (t nil)))
 
-(defun display-buffer-other-frame (buffer)
-  "Display buffer BUFFER in another frame.
-This uses the function `display-buffer' as a subroutine; see
-its documentation for additional customization information."
-  (interactive "BDisplay buffer in other frame: ")
-  (let ((pop-up-frames t)
-       same-window-buffer-names same-window-regexps
-        (old-window (selected-window))
-       new-window)
-    (setq new-window (display-buffer buffer t))
-    ;; This may have been here in order to prevent the new frame from hiding
-    ;; the old frame.  But it does more harm than good.
-    ;; Maybe we should call `raise-window' on the old-frame instead?  --Stef
-    ;;(lower-frame (window-frame new-window))
-
-    ;; This may have been here in order to make sure the old-frame gets the
-    ;; focus.  But not only can it cause an annoying flicker, with some
-    ;; window-managers it just makes the window invisible, with no easy
-    ;; way to recover it.  --Stef
-    ;;(make-frame-invisible (window-frame old-window))
-    ;;(make-frame-visible (window-frame old-window))
-    ))
-
 (defmacro minibuffer-with-setup-hook (fun &rest body)
   "Temporarily add FUN to `minibuffer-setup-hook' while executing BODY.
 BODY should use the minibuffer at most once.
index 40e87cd6709a9e0bbad27732d6927cfe0a9c5bc0..adb1a54901c85725241d98388cd9a4e696cc8254 100644 (file)
@@ -543,8 +543,6 @@ Customized bindings may be defined in `ielm-map', which currently contains:
 
 ;;; User command
 
-;;;###autoload (add-hook 'same-window-buffer-names (purecopy "*ielm*"))
-
 ;;;###autoload
 (defun ielm nil
   "Interactively evaluate Emacs Lisp expressions.
@@ -555,7 +553,7 @@ Switches to the buffer `*ielm*', or creates it if it does not exist."
       (with-current-buffer (get-buffer-create "*ielm*")
        (unless (zerop (buffer-size)) (setq old-point (point)))
        (inferior-emacs-lisp-mode)))
-    (pop-to-buffer "*ielm*")
+    (pop-to-buffer-same-window "*ielm*")
     (when old-point (push-mark old-point))))
 
 (provide 'ielm)
index 877cc5aa399bb120807357970d37a907095fe713..bb74a6025d06c5769fb8d937c2168b82c81e324a 100644 (file)
@@ -334,11 +334,12 @@ mail-sending package is used for editing and sending the message."
     ;; do the work
     (require 'sendmail)
     ;; 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-other-window mailbuf)
+    ;; Just in case the original buffer is not visible now, bring it
+    ;; back somewhere.
+    (display-buffer
+     reporter-eval-buffer
+     '(same-frame (not-this-window . t) (reuse-buffer-window . nil)))
     (goto-char (point-min))
     (mail-position-on-field "to")
     (insert address)
index 081e743dcd88a81fe3c003165eb232700701a4d8..e48a4470149460c5d4078fac0bb9eb4dcba5464c 100644 (file)
@@ -784,21 +784,26 @@ Prefix arg means don't delete this window."
   "Bury this mail buffer."
   (let ((newbuf (other-buffer (current-buffer))))
     (bury-buffer (current-buffer))
+    ;; The inherent assumption is that we are in the selected window so
+    ;; using `frame-selected-window' doesn't make any sense.  We should
+    ;; be able to use `quit-restore-window' here but I don't understand
+    ;; all implications of the code so try to do what was done before.
     (if (and (or nil
                 ;; In this case, we need to go to a different frame.
-                (window-dedicated-p (frame-selected-window))
-                ;; In this mode of operation, the frame was probably
-                ;; made for this buffer, so the user probably wants
-                ;; to delete it now.
-                (and pop-up-frames (one-window-p))
+                (window-dedicated-p)
+                (let ((quit-restore (window-parameter nil 'quit-restore)))
+                  (and (memq (car-safe quit-restore) '(new-window new-frame))
+                       ;; Check that WINDOW's buffer is still the same.
+                       (eq (window-buffer) (nth 1 quit-restore))))
                 (cdr (assq 'mail-dedicated-frame (frame-parameters))))
-            (not (null (delq (selected-frame) (visible-frame-list)))))
+            (other-visible-frames-p))
        (progn
          (if (display-multi-frame-p)
              (delete-frame (selected-frame))
            ;; The previous frame is where normally they have the
            ;; Rmail buffer displayed.
            (other-frame -1)))
+
       (let (rmail-flag summary-buffer)
        (and (not arg)
             (not (one-window-p))
@@ -1662,9 +1667,6 @@ If the current line has `mail-yank-prefix', insert it on the new line."
 ;; Put these commands last, to reduce chance of lossage from quitting
 ;; in middle of loading the file.
 
-;;;###autoload (add-hook 'same-window-buffer-names (purecopy "*mail*"))
-;;;###autoload (add-hook 'same-window-buffer-names (purecopy "*unsent mail*"))
-
 ;;;###autoload
 (defun mail (&optional noerase to subject in-reply-to cc replybuffer actions)
   "Edit a message to be sent.  Prefix arg means resume editing (don't erase).
@@ -1758,11 +1760,11 @@ The seventh argument ACTIONS is a list of actions to take
  ;;         t))
 
   (if (eq noerase 'new)
-      (pop-to-buffer (generate-new-buffer "*mail*"))
+      (pop-to-buffer-same-window (generate-new-buffer "*mail*"))
     (and noerase
         (not (get-buffer "*mail*"))
         (setq noerase nil))
-    (pop-to-buffer "*mail*"))
+    (pop-to-buffer-same-window "*mail*"))
 
   ;; Avoid danger that the auto-save file can't be written.
   (let ((dir (expand-file-name
@@ -1931,24 +1933,14 @@ you can move to one of them and type C-c C-c to recover that one."
 (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*"))
+  (pop-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*"))
+  (pop-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.
index 77f3296751a29c1f43696cfecc5bc778da51d2ed..f99a3009adaf05405c0af8fe9ee0e84e4705aa1e 100644 (file)
@@ -131,8 +131,6 @@ this variable is set from that."
   (define-key rlogin-mode-map "\C-i" 'rlogin-tab-or-complete)))
 
 \f
-;;;###autoload (add-hook 'same-window-regexps (purecopy "^\\*rlogin-.*\\*\\(\\|<[0-9]+>\\)"))
-
 (defvar rlogin-history nil)
 
 ;;;###autoload
@@ -205,7 +203,7 @@ variable."
            (setq buffer-name (generate-new-buffer-name buffer-name))))
 
     (setq buffer (get-buffer-create buffer-name))
-    (pop-to-buffer buffer-name)
+    (pop-to-buffer-same-window buffer-name)
 
     (unless (comint-check-proc buffer-name)
       (comint-exec buffer buffer-name rlogin-program nil args)
index 25bf7db7612b90f61a2e74c5cd64ac6dcaf56de3..31a0e92e4632207fa206c39bf6bcb7a558846387 100644 (file)
@@ -190,8 +190,6 @@ rejecting one login and prompting again for a username and password.")
       (delete-region comint-last-input-start
                     comint-last-input-end)))
 
-;;;###autoload (add-hook 'same-window-regexps (purecopy "\\*telnet-.*\\*\\(\\|<[0-9]+>\\)"))
-
 ;;;###autoload
 (defun telnet (host &optional port)
   "Open a network login connection to host named HOST (a string).
@@ -219,8 +217,8 @@ Normally input is edited in Emacs and sent a line at a time."
         (telnet-options (if (cdr properties) (cons "-l" (cdr properties))))
         process)
     (if (and buffer (get-buffer-process buffer))
-       (pop-to-buffer (concat "*" name "*"))
-      (pop-to-buffer
+       (pop-to-buffer-same-window (concat "*" name "*"))
+      (pop-to-buffer-same-window
        (apply 'make-comint name telnet-program nil telnet-options))
       (setq process (get-buffer-process (current-buffer)))
       (set-process-filter process 'telnet-initial-filter)
@@ -246,8 +244,6 @@ Data is sent to the remote host when RET is typed."
   (set (make-local-variable 'comint-prompt-regexp) telnet-prompt-pattern)
   (set (make-local-variable 'comint-use-prompt-regexp) t))
 
-;;;###autoload (add-hook 'same-window-regexps (purecopy "\\*rsh-[^-]*\\*\\(\\|<[0-9]*>\\)"))
-
 ;;;###autoload
 (defun rsh (host)
   "Open a network login connection to host named HOST (a string).
@@ -256,7 +252,8 @@ Normally input is edited in Emacs and sent a line at a time."
   (interactive "sOpen rsh connection to host: ")
   (require 'shell)
   (let ((name (concat "rsh-" host )))
-    (pop-to-buffer (make-comint name remote-shell-program nil host))
+    (pop-to-buffer-same-window
+     (make-comint name remote-shell-program nil host))
     (set-process-filter (get-process name) 'telnet-initial-filter)
     (telnet-mode)
     (setq telnet-count -16)))
index aacd8d42ae431d26987900c2b38d976c33d840d4..7f9d7e55cbca3af0f584b9105b67222dc3d70431 100644 (file)
@@ -5837,9 +5837,11 @@ If menu binding was not done, calls `pr-menu-bind'."
   (mapcar #'(lambda (file)
              (and (or pr-list-directory
                       (not (file-directory-p file)))
-                  (let ((buffer (pr-find-buffer-visiting file))
-                        pop-up-windows
-                        pop-up-frames)
+                  (let ((buffer (pr-find-buffer-visiting file)))
+                    ;; Commented out the following two until I know
+                    ;; what they are used for.
+                    ;; pop-up-windows
+                    ;; pop-up-frames)
                     (and (or buffer
                              (file-readable-p file))
                          (with-current-buffer (or buffer
index 41ce378e96647557ed52532a4f06c4f9ecf62fa3..c4d6e23a315159dee367e3f168d67858b349e187 100644 (file)
@@ -305,8 +305,7 @@ of `inferior-lisp-program').  Runs the hooks from
                           "inferior-lisp" (car cmdlist) nil (cdr cmdlist)))
        (inferior-lisp-mode)))
   (setq inferior-lisp-buffer "*inferior-lisp*")
-  (pop-to-buffer "*inferior-lisp*"))
-;;;###autoload (add-hook 'same-window-buffer-names (purecopy "*inferior-lisp*"))
+  (pop-to-buffer-same-window "*inferior-lisp*"))
 
 ;;;###autoload
 (defalias 'run-lisp 'inferior-lisp)
@@ -381,13 +380,10 @@ Prefix argument means switch to the Lisp buffer afterwards."
 With argument, positions cursor at end of buffer."
   (interactive "P")
   (if (get-buffer-process inferior-lisp-buffer)
-      (let ((pop-up-frames
-            ;; Be willing to use another frame
-            ;; that already has the window in it.
-            (or pop-up-frames
-                (get-buffer-window inferior-lisp-buffer t))))
-       (pop-to-buffer inferior-lisp-buffer))
-      (run-lisp inferior-lisp-program))
+      (pop-to-buffer
+       ;; Trying to guess what was here previously.
+       inferior-lisp-buffer '(other-frame (reuse-buffer-window . t) same-window))
+    (run-lisp inferior-lisp-program))
   (when eob-p
         (push-mark)
     (goto-char (point-max))))
index baea2820433e1c409b0943d5c56abdc4b9068f9d..d266a8960d9d6f2e1d54a7bd14ad05f57c664797 100644 (file)
@@ -878,10 +878,8 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
            (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-other-window (marker-buffer pos))
     (goto-char pos)
     (run-hooks 'occur-mode-find-occurrence-hook)))
 
@@ -897,11 +895,8 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
   "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-other-window (marker-buffer pos)))
     ;; This is the way to set point in the proper window.
     (save-selected-window
       (select-window window)
index 6cb9a51110111c92cc6fb05e9b1e3f3f8f23fada..7831188d281b7d85e083261a71f603f7eda8696f 100644 (file)
@@ -558,7 +558,7 @@ Otherwise, one argument `-i' is passed to the shell.
   (setq buffer (get-buffer-create (or buffer "*shell*")))
   ;; Pop to buffer, so that the buffer's window will be correctly set
   ;; when we call comint (so that comint sets the COLUMNS env var properly).
-  (pop-to-buffer buffer)
+  (pop-to-buffer-same-window buffer)
   (unless (comint-check-proc buffer)
     (let* ((prog (or explicit-shell-file-name
                     (getenv "ESHELL") shell-file-name))
@@ -575,9 +575,6 @@ Otherwise, one argument `-i' is passed to the shell.
       (shell-mode)))
   buffer)
 
-;; Don't do this when shell.el is loaded, only while dumping.
-;;;###autoload (add-hook 'same-window-buffer-names (purecopy "*shell*"))
-
 ;;; Directory tracking
 ;;
 ;; This code provides the shell mode input sentinel
index b03548d5a7343b73a1ce8badec50d7629c0f3450..e94c86e410c6065c6f080f2c0802d2ed703b1366 100644 (file)
@@ -2283,7 +2283,7 @@ the use of a shell (with its need to quote arguments)."
                                     output-buffer nil error-buffer)))))))
 
 (defun display-message-or-buffer (message
-                                 &optional buffer-name not-this-window frame)
+                                 &optional buffer-name not-this-window ignore)
   "Display MESSAGE in the echo area if possible, otherwise in a pop-up buffer.
 MESSAGE may be either a string or a buffer.
 
@@ -2300,8 +2300,9 @@ is used, defaulting to `*Message*'.  In the case where MESSAGE is a
 string and it is displayed in the echo area, it is not specified whether
 the contents are inserted into the buffer anyway.
 
-Optional arguments NOT-THIS-WINDOW and FRAME are as for `display-buffer',
-and only used if a buffer is displayed."
+Optional argument NOT-THIS-WINDOW is as for `display-buffer', and
+only used if a buffer is displayed.  Optional argument IGNORE is
+ignored."
   (cond ((and (stringp message) (not (string-match "\n" message)))
         ;; Trivial case where we can use the echo area
         (message "%s" message))
@@ -2347,8 +2348,7 @@ and only used if a buffer is displayed."
                   (t
                    ;; Buffer
                    (goto-char (point-min))
-                   (display-buffer (current-buffer)
-                                   not-this-window frame))))))))
+                   (display-buffer nil not-this-window))))))))
 
 
 ;; We have a sentinel to prevent insertion of a termination message
@@ -5666,12 +5666,8 @@ appears to have customizations applying to the old default,
 (defun sendmail-user-agent-compose (&optional to subject other-headers continue
                                              switch-function yank-action
                                              send-actions)
-  (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*")))
+  (when switch-function
+    (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))))
@@ -6391,9 +6387,7 @@ after it has been set up properly in other respects."
     (if display-flag
         ;; Presumably the current buffer is shown in the selected frame, so
         ;; we want to display the clone elsewhere.
-        (let ((same-window-regexps nil)
-              (same-window-buffer-names))
-          (pop-to-buffer new)))
+       (pop-to-buffer-other-window new))
     new))
 
 
@@ -6408,11 +6402,13 @@ or by incrementing the N in an existing suffix.  Trying to clone a
 buffer whose major mode symbol has a non-nil `no-clone-indirect'
 property results in an error.
 
-DISPLAY-FLAG non-nil means show the new buffer with `pop-to-buffer'.
-This is always done when called interactively.
+DISPLAY-FLAG non-nil means show the new buffer with
+`pop-to-buffer'.  This is always done when called interactively.
+Non-interactively, if DISPLAY-FLAG equals 'other-window, display
+the buffer in another window.
 
-Optional third arg NORECORD non-nil means do not put this buffer at the
-front of the list of recently selected ones."
+Optional third arg NORECORD non-nil means do not put this buffer
+at the front of the list of recently selected ones."
   (interactive
    (progn
      (if (get major-mode 'no-clone-indirect)
@@ -6430,10 +6426,9 @@ front of the list of recently selected ones."
     (with-current-buffer buffer
       (run-hooks 'clone-indirect-buffer-hook))
     (when display-flag
-      (pop-to-buffer buffer norecord))
+      (pop-to-buffer buffer (eq display-flag 'other-window) norecord))
     buffer))
 
-
 (defun clone-indirect-buffer-other-window (newname display-flag &optional norecord)
   "Like `clone-indirect-buffer' but display in another window."
   (interactive
@@ -6442,9 +6437,8 @@ front of the list of recently selected ones."
         (error "Cannot indirectly clone a buffer in %s mode" mode-name))
      (list (if current-prefix-arg
               (read-buffer "Name of indirect buffer: " (current-buffer)))
-          t)))
-  (let ((pop-up-windows t))
-    (clone-indirect-buffer newname display-flag norecord)))
+          'other-window)))
+  (clone-indirect-buffer newname display-flag norecord))
 
 \f
 ;;; Handling of Backspace and Delete keys.
index 75dd4f80153febf471ef7cdcfc9f37d78636fac2..51be5b2c10c47c03537fca9f52c6c3e7fcb44bb9 100644 (file)
@@ -3603,9 +3603,8 @@ mode is not `bibtex-mode', START is nil, and DISPLAY is t."
                 ;; `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)
+               (progn
+                 (pop-to-buffer-same-window buffer)
                  (bibtex-reposition-window)))
               (found (set-buffer buffer))
               (display (message "Key `%s' not found" key)))