From d929c3197903cd5f1f9bc366f340d654cecca3ae Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Sun, 7 Nov 2010 20:47:18 +0100 Subject: [PATCH] Rewrite more functions with 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. * 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. --- lisp/ChangeLog | 80 ++++++++++++++++++++++++++++++++++++++ lisp/calendar/solar.el | 12 +----- lisp/cmuscheme.el | 3 +- lisp/eshell/eshell.el | 26 +------------ lisp/files.el | 23 ----------- lisp/ielm.el | 4 +- lisp/mail/reporter.el | 11 +++--- lisp/mail/sendmail.el | 38 +++++++----------- lisp/net/rlogin.el | 4 +- lisp/net/telnet.el | 11 ++---- lisp/printing.el | 8 ++-- lisp/progmodes/inf-lisp.el | 14 +++---- lisp/replace.el | 13 ++----- lisp/shell.el | 5 +-- lisp/simple.el | 40 ++++++++----------- lisp/textmodes/bibtex.el | 5 +-- 16 files changed, 146 insertions(+), 151 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0019e06e717..e0ae662f3ec 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,77 @@ +2010-11-07 Martin Rudalics + + * 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 + + * 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 * window.el (display-buffer-even-sizes) @@ -14,6 +88,12 @@ * 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 * window.el (display-buffer-names, display-buffer-regexps): Make diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el index b7a728461f0..11d4c2c3f6f 100644 --- a/lisp/calendar/solar.el +++ b/lisp/calendar/solar.el @@ -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) diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el index 9cf5356fa67..97b6829b30e 100644 --- a/lisp/cmuscheme.el +++ b/lisp/cmuscheme.el @@ -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. diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index 89ec3ab9c60..eaa0d1a3b0e 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el @@ -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)) diff --git a/lisp/files.el b/lisp/files.el index 6a7a9b09a48..72444b70aca 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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. diff --git a/lisp/ielm.el b/lisp/ielm.el index 40e87cd6709..adb1a54901c 100644 --- a/lisp/ielm.el +++ b/lisp/ielm.el @@ -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) diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el index 877cc5aa399..bb74a6025d0 100644 --- a/lisp/mail/reporter.el +++ b/lisp/mail/reporter.el @@ -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) diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index 081e743dcd8..e48a4470149 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -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. diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el index 77f3296751a..f99a3009ada 100644 --- a/lisp/net/rlogin.el +++ b/lisp/net/rlogin.el @@ -131,8 +131,6 @@ this variable is set from that." (define-key rlogin-mode-map "\C-i" 'rlogin-tab-or-complete))) -;;;###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) diff --git a/lisp/net/telnet.el b/lisp/net/telnet.el index 25bf7db7612..31a0e92e463 100644 --- a/lisp/net/telnet.el +++ b/lisp/net/telnet.el @@ -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))) diff --git a/lisp/printing.el b/lisp/printing.el index aacd8d42ae4..7f9d7e55cbc 100644 --- a/lisp/printing.el +++ b/lisp/printing.el @@ -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 diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el index 41ce378e966..c4d6e23a315 100644 --- a/lisp/progmodes/inf-lisp.el +++ b/lisp/progmodes/inf-lisp.el @@ -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)))) diff --git a/lisp/replace.el b/lisp/replace.el index baea2820433..d266a8960d9 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -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) diff --git a/lisp/shell.el b/lisp/shell.el index 6cb9a511101..7831188d281 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -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 diff --git a/lisp/simple.el b/lisp/simple.el index b03548d5a73..e94c86e410c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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)) ;;; Handling of Backspace and Delete keys. diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 75dd4f80153..51be5b2c10c 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -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))) -- 2.39.5