+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
(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)
(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.
;; 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)
"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
(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))
'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.
;;; User command
-;;;###autoload (add-hook 'same-window-buffer-names (purecopy "*ielm*"))
-
;;;###autoload
(defun ielm nil
"Interactively evaluate Emacs Lisp expressions.
(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)
;; 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)
"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))
;; 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).
;; 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
(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.
(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
(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)
(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).
(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)
(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).
(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)))
(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
"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)
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))))
(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)))
"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)
(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))
(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
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.
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))
(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
(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))))
(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))
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)
(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
(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.
;; `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)))