Commit 37ac18a3 authored by Chong Yidong's avatar Chong Yidong

Change modes that used same-window-* vars to use switch-to-buffer.

* cmuscheme.el (run-scheme, switch-to-scheme):
* ielm.el (ielm):
* shell.el (shell):
* net/rlogin.el (rlogin):
* net/telnet.el (telnet, rsh):
* progmodes/inf-lisp.el (inferior-lisp): Use switch-to-buffer.

* cus-edit.el (customize-group, custom-buffer-create)
(customize-browse, custom-buffer-create-other-window): Use
switch-to-buffer or switch-to-buffer-other-window.

* info.el (info, Info-find-node, Info-revert-find-node, Info-next)
(Info-prev, Info-up, Info-speedbar-goto-node)
(info-display-manual): Use switch-to-buffer.
(Info-speedbar-goto-node): Use switch-to-buffer-other-frame.

* lisp/gnus/message.el (message-pop-to-buffer): Default to switch-to-buffer.
(message-mail-other-window, message-mail-other-frame)
(message-news-other-window, message-news-other-frame): Use
switch-to-buffer-other-frame and switch-to-buffer-other-window instead
of setting buffer display varibles.

* mail/sendmail.el (mail): Use switch-to-buffer.
(mail-recover): Use switch-to-buffer-other-window.

* progmodes/gdb-mi.el (gdb-restore-windows, gdb-setup-windows):
Use switch-to-buffer.
parent d562d7a4
2011-09-11 Chong Yidong <cyd@stupidchicken.com>
Change modes that used same-window-* vars to use switch-to-buffer.
* progmodes/gdb-mi.el (gdb-restore-windows, gdb-setup-windows):
Use switch-to-buffer.
* cus-edit.el (customize-group, custom-buffer-create)
(customize-browse, custom-buffer-create-other-window): Use
switch-to-buffer or switch-to-buffer-other-window.
* info.el (info, Info-find-node, Info-revert-find-node, Info-next)
(Info-prev, Info-up, Info-speedbar-goto-node)
(info-display-manual): Use switch-to-buffer.
(Info-speedbar-goto-node): Use switch-to-buffer-other-frame.
* mail/sendmail.el (mail): Use switch-to-buffer.
(mail-recover): Use switch-to-buffer-other-window.
* cmuscheme.el (run-scheme, switch-to-scheme):
* ielm.el (ielm):
* shell.el (shell):
* net/rlogin.el (rlogin):
* net/telnet.el (telnet, rsh):
* progmodes/inf-lisp.el (inferior-lisp): Use switch-to-buffer.
2011-09-11 Andreas Schwab <schwab@linux-m68k.org>
* dired.el (dired-sort-toggle-or-edit): Revert last changes.
......
......@@ -246,7 +246,7 @@ is run).
(inferior-scheme-mode)))
(setq scheme-program-name cmd)
(setq scheme-buffer "*scheme*")
(pop-to-buffer "*scheme*"))
(switch-to-buffer "*scheme*"))
(defun scheme-start-file (prog)
"Return the name of the start file corresponding to PROG.
......@@ -371,7 +371,7 @@ With argument, position cursor at end of buffer."
(interactive "P")
(if (or (and scheme-buffer (get-buffer scheme-buffer))
(scheme-interactively-start-process))
(pop-to-buffer scheme-buffer)
(switch-to-buffer scheme-buffer)
(error "No current process buffer. See variable `scheme-buffer'"))
(when eob-p
(push-mark)
......
......@@ -1112,7 +1112,7 @@ If OTHER-WINDOW is non-nil, display in another window."
(let ((name (format "*Customize Group: %s*"
(custom-unlispify-tag-name group))))
(if (get-buffer name)
(pop-to-buffer name other-window)
(switch-to-buffer name other-window)
(funcall (if other-window
'custom-buffer-create-other-window
'custom-buffer-create)
......@@ -1533,7 +1533,7 @@ Optional NAME is the name of the buffer.
OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
SYMBOL is a customization option, and WIDGET is a widget for editing
that option."
(pop-to-buffer (custom-get-fresh-buffer (or name "*Customization*")))
(switch-to-buffer (custom-get-fresh-buffer (or name "*Customization*")))
(custom-buffer-create-internal options description))
;;;###autoload
......@@ -1545,7 +1545,7 @@ OPTIONS should be an alist of the form ((SYMBOL WIDGET)...), where
SYMBOL is a customization option, and WIDGET is a widget for editing
that option."
(unless name (setq name "*Customization*"))
(pop-to-buffer (custom-get-fresh-buffer name) t)
(switch-to-buffer-other-window (custom-get-fresh-buffer name))
(custom-buffer-create-internal options description))
(defcustom custom-reset-button-menu nil
......@@ -1721,7 +1721,7 @@ Otherwise use brackets."
(unless group
(setq group 'emacs))
(let ((name "*Customize Browser*"))
(pop-to-buffer (custom-get-fresh-buffer name)))
(switch-to-buffer (custom-get-fresh-buffer name)))
(Custom-mode)
(widget-insert (format "\
%s buttons; type RET or click mouse-1
......
2011-09-11 Chong Yidong <cyd@stupidchicken.com>
* message.el (message-pop-to-buffer): Default to switch-to-buffer.
(message-mail-other-window, message-mail-other-frame)
(message-news-other-window, message-news-other-frame): Use
switch-to-buffer-other-frame and switch-to-buffer-other-window instead
of setting buffer display varibles.
2011-09-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
* gnus-dup.el (gnus-dup-suppress-articles): Move "Suppressing
......
......@@ -6329,7 +6329,7 @@ between beginning of field and beginning of line."
(progn
(gnus-select-frame-set-input-focus (window-frame window))
(select-window window))
(funcall (or switch-function 'pop-to-buffer) buffer)
(funcall (or switch-function 'switch-to-buffer) buffer)
(set-buffer buffer))
(when (and (buffer-modified-p)
(not (prog1
......@@ -6337,7 +6337,7 @@ between beginning of field and beginning of line."
"Message already being composed; erase? ")
(message nil))))
(error "Message being composed")))
(funcall (or switch-function 'pop-to-buffer) name)
(funcall (or switch-function 'switch-to-buffer) name)
(set-buffer name))
(erase-buffer)
(message-mode)))
......@@ -7619,12 +7619,8 @@ you."
"Like `message-mail' command, but display mail buffer in another window."
(interactive)
(unless (message-mail-user-agent)
(let ((pop-up-windows t)
(special-display-buffer-names nil)
(special-display-regexps nil)
(same-window-buffer-names nil)
(same-window-regexps nil))
(message-pop-to-buffer (message-buffer-name "mail" to))))
(message-pop-to-buffer (message-buffer-name "mail" to)
'switch-to-buffer-other-window))
(let ((message-this-is-mail t))
(message-setup `((To . ,(or to "")) (Subject . ,(or subject "")))
nil nil nil 'switch-to-buffer-other-window)))
......@@ -7634,12 +7630,8 @@ you."
"Like `message-mail' command, but display mail buffer in another frame."
(interactive)
(unless (message-mail-user-agent)
(let ((pop-up-frames t)
(special-display-buffer-names nil)
(special-display-regexps nil)
(same-window-buffer-names nil)
(same-window-regexps nil))
(message-pop-to-buffer (message-buffer-name "mail" to))))
(message-pop-to-buffer (message-buffer-name "mail" to)
'switch-to-buffer-other-frame))
(let ((message-this-is-mail t))
(message-setup `((To . ,(or to "")) (Subject . ,(or subject "")))
nil nil nil 'switch-to-buffer-other-frame)))
......@@ -7648,12 +7640,8 @@ you."
(defun message-news-other-window (&optional newsgroups subject)
"Start editing a news article to be sent."
(interactive)
(let ((pop-up-windows t)
(special-display-buffer-names nil)
(special-display-regexps nil)
(same-window-buffer-names nil)
(same-window-regexps nil))
(message-pop-to-buffer (message-buffer-name "posting" nil newsgroups)))
(message-pop-to-buffer (message-buffer-name "posting" nil newsgroups)
'switch-to-buffer-other-window)
(let ((message-this-is-news t))
(message-setup `((Newsgroups . ,(or newsgroups ""))
(Subject . ,(or subject ""))))))
......@@ -7662,12 +7650,8 @@ you."
(defun message-news-other-frame (&optional newsgroups subject)
"Start editing a news article to be sent."
(interactive)
(let ((pop-up-frames t)
(special-display-buffer-names nil)
(special-display-regexps nil)
(same-window-buffer-names nil)
(same-window-regexps nil))
(message-pop-to-buffer (message-buffer-name "posting" nil newsgroups)))
(message-pop-to-buffer (message-buffer-name "posting" nil newsgroups)
'switch-to-buffer-other-frame)
(let ((message-this-is-news t))
(message-setup `((Newsgroups . ,(or newsgroups ""))
(Subject . ,(or subject ""))))))
......
......@@ -563,7 +563,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*")
(switch-to-buffer "*ielm*")
(when old-point (push-mark old-point))))
(provide 'ielm)
......
......@@ -610,7 +610,7 @@ in `Info-file-supports-index-cookies-list'."
"Like `info' but show the Info buffer in another window."
(interactive (if current-prefix-arg
(list (read-file-name "Info file name: " nil nil t))))
(info-setup file-or-node (pop-to-buffer "*info*" t)))
(info-setup file-or-node (switch-to-buffer-other-window "*info*")))
;;;###autoload (put 'info 'info-file (purecopy "emacs"))
;;;###autoload
......@@ -640,7 +640,7 @@ See a list of available Info commands in `Info-mode'."
(read-file-name "Info file name: " nil nil t))
(if (numberp current-prefix-arg)
(format "*info*<%s>" current-prefix-arg))))
(info-setup file-or-node (pop-to-buffer (or buffer "*info*"))))
(info-setup file-or-node (switch-to-buffer (or buffer "*info*"))))
(defun info-setup (file-or-node buffer)
"Display Info node FILE-OR-NODE in BUFFER."
......@@ -775,7 +775,7 @@ it says do not attempt further (recursive) error recovery."
(info-initialize)
(setq filename (Info-find-file filename))
;; Go into Info buffer.
(or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
(or (eq major-mode 'Info-mode) (switch-to-buffer "*info*"))
;; Record the node we are leaving, if we were in one.
(and (not no-going-back)
Info-current-file
......@@ -809,7 +809,7 @@ otherwise, that defaults to `Top'."
"Go to an Info node FILENAME and NODENAME, re-reading disk contents.
When *info* is already displaying FILENAME and NODENAME, the window position
is preserved, if possible."
(or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
(or (eq major-mode 'Info-mode) (switch-to-buffer "*info*"))
(let ((old-filename Info-current-file)
(old-nodename Info-current-node)
(old-buffer-name (buffer-name))
......@@ -821,7 +821,7 @@ is preserved, if possible."
(new-history (and Info-current-file
(list Info-current-file Info-current-node (point)))))
(kill-buffer (current-buffer))
(pop-to-buffer (or old-buffer-name "*info*"))
(switch-to-buffer (or old-buffer-name "*info*"))
(Info-mode)
(Info-find-node filename nodename)
(setq Info-history-forward old-history-forward)
......@@ -2021,7 +2021,7 @@ End of submatch 0, 1, and 3 are the same, so you can safely concat."
(interactive)
;; In case another window is currently selected
(save-window-excursion
(or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
(or (eq major-mode 'Info-mode) (switch-to-buffer "*info*"))
(Info-goto-node (Info-extract-pointer "next"))))
(defun Info-prev ()
......@@ -2029,7 +2029,7 @@ End of submatch 0, 1, and 3 are the same, so you can safely concat."
(interactive)
;; In case another window is currently selected
(save-window-excursion
(or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
(or (eq major-mode 'Info-mode) (switch-to-buffer "*info*"))
(Info-goto-node (Info-extract-pointer "prev[ious]*" "previous"))))
(defun Info-up (&optional same-file)
......@@ -2038,7 +2038,7 @@ If SAME-FILE is non-nil, do not move to a different Info file."
(interactive)
;; In case another window is currently selected
(save-window-excursion
(or (eq major-mode 'Info-mode) (pop-to-buffer "*info*"))
(or (eq major-mode 'Info-mode) (switch-to-buffer "*info*"))
(let ((old-node Info-current-node)
(old-file Info-current-file)
(node (Info-extract-pointer "up")) p)
......@@ -4775,7 +4775,7 @@ The INDENT level is ignored."
(select-window bwin)
(raise-frame (window-frame bwin)))
(if speedbar-power-click
(let ((pop-up-frames t)) (select-window (display-buffer buff)))
(switch-to-buffer-other-frame buff)
(speedbar-select-attached-frame)
(switch-to-buffer buff)))
(if (not (string-match "^(\\([^)]+\\))\\([^.]+\\)$" node))
......@@ -4954,7 +4954,7 @@ type returned by `Info-bookmark-make-record', which see."
(setq found buffer
blist nil))))
(if found
(pop-to-buffer found)
(switch-to-buffer found)
(info-initialize)
(info (Info-find-file manual)))))
......
......@@ -1785,11 +1785,11 @@ The seventh argument ACTIONS is a list of actions to take
This is how Rmail arranges to mark messages `answered'."
(interactive "P")
(if (eq noerase 'new)
(pop-to-buffer (generate-new-buffer "*mail*"))
(switch-to-buffer (generate-new-buffer "*mail*"))
(and noerase
(not (get-buffer "*mail*"))
(setq noerase nil))
(pop-to-buffer "*mail*"))
(switch-to-buffer "*mail*"))
;; Avoid danger that the auto-save file can't be written.
(let ((dir (expand-file-name
......@@ -1939,7 +1939,7 @@ you can move to one of them and type C-c C-c to recover that one."
(dired-noselect file-name
(concat dired-listing-switches " -t"))))
(save-selected-window
(select-window (display-buffer dispbuf t))
(switch-to-buffer-other-window dispbuf)
(goto-char (point-min))
(forward-line 2)
(dired-move-to-filename)
......
......@@ -194,7 +194,7 @@ variable."
(t
(setq buffer-name (generate-new-buffer-name buffer-name))))
(setq buffer (get-buffer-create buffer-name))
(pop-to-buffer buffer-name)
(switch-to-buffer buffer-name)
(unless (comint-check-proc buffer-name)
(comint-exec buffer buffer-name rlogin-program nil args)
(rlogin-mode)
......
......@@ -217,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
(switch-to-buffer (concat "*" name "*"))
(switch-to-buffer
(apply 'make-comint name telnet-program nil telnet-options))
(setq process (get-buffer-process (current-buffer)))
(set-process-filter process 'telnet-initial-filter)
......@@ -252,7 +252,7 @@ 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))
(switch-to-buffer (make-comint name remote-shell-program nil host))
(set-process-filter (get-process name) 'telnet-initial-filter)
(telnet-mode)
(setq telnet-count -16)))
......
......@@ -4006,7 +4006,7 @@ window is dedicated."
(gdb-display-breakpoints-buffer)
(delete-other-windows)
;; Don't dedicate.
(pop-to-buffer gud-comint-buffer)
(switch-to-buffer gud-comint-buffer)
(let ((win0 (selected-window))
(win1 (split-window nil ( / ( * (window-height) 3) 4)))
(win2 (split-window nil ( / (window-height) 3)))
......@@ -4065,7 +4065,7 @@ With arg, display additional buffers iff arg is positive."
"Restore the basic arrangement of windows used by gdb.
This arrangement depends on the value of `gdb-many-windows'."
(interactive)
(pop-to-buffer gud-comint-buffer) ;Select the right window and frame.
(switch-to-buffer gud-comint-buffer) ;Select the right window and frame.
(delete-other-windows)
(if gdb-many-windows
(gdb-setup-windows)
......
......@@ -2496,7 +2496,7 @@ comint mode, which see."
file-subst)))
(filepart (and file-word (concat "-" (file-name-nondirectory file))))
(existing-buffer (get-buffer (concat "*gud" filepart "*"))))
(pop-to-buffer (concat "*gud" filepart "*"))
(switch-to-buffer (concat "*gud" filepart "*"))
(when (and existing-buffer (get-buffer-process existing-buffer))
(error "This program is already being debugged"))
;; Set the dir, in case the buffer already existed with a different dir.
......
......@@ -297,7 +297,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*"))
(switch-to-buffer "*inferior-lisp*"))
;;;###autoload
(defalias 'run-lisp 'inferior-lisp)
......
......@@ -650,9 +650,9 @@ Otherwise, one argument `-i' is passed to the shell.
t shell-file-name))
'localname))))
;; 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)
;; The buffer's window must be correctly set when we call comint (so
;; that comint sets the COLUMNS env var properly).
(switch-to-buffer buffer)
(unless (comint-check-proc buffer)
(let* ((prog (or explicit-shell-file-name
(getenv "ESHELL") shell-file-name))
......
......@@ -4498,11 +4498,7 @@ BUFFER-OR-NAME and return that buffer."
buffer))
(current-buffer)))
(defvar display-buffer-alist
'(("\\`\\*\\(scheme\\|ielm\\|shell\\|\\(unsent \\)?mail\\|\
inferior-lisp\\|Python\\|Customiz.*\\|info\\|rlogin-.*\\|\
telnet-.*\\|rsh-.*\\|gud-.*\\)\\*\\(<[0-9]+>\\)?"
. (display-buffer-same-window)))
(defvar display-buffer-alist nil
"Alist of conditional actions for `display-buffer'.
This is a list of elements (CONDITION . ACTION), where:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment