From 1530c98e56d331a21ba7ef2c940d1441442ac798 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 11 Aug 2012 00:46:07 +0800 Subject: [PATCH] Remove some unnecessary bindings of same-window-* variables. * lisp/progmodes/python.el (python-shell-get-process-name): Don't mess with same-window-buffer-names. * lisp/eshell/eshell.el (eshell-add-to-window-buffer-names) (eshell-remove-from-window-buffer-names): Make obsolete. (eshell-buffer-name, eshell-unload-hook): Don't use them. (eshell): Just use pop-to-buffer-same-window instead. --- lisp/ChangeLog | 10 ++++++++++ lisp/eshell/eshell.el | 27 ++++++++------------------- lisp/progmodes/python.el | 6 +----- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b6649d4b37..bc270b8bdb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2012-08-10 Chong Yidong + + * progmodes/python.el (python-shell-get-process-name): Don't mess + with same-window-buffer-names. + + * eshell/eshell.el (eshell-add-to-window-buffer-names) + (eshell-remove-from-window-buffer-names): Make obsolete. + (eshell-buffer-name, eshell-unload-hook): Don't use them. + (eshell): Just use pop-to-buffer-same-window instead. + 2012-08-10 Chong Yidong * bindings.el: Bind M-= back to count-words-region. diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index a171775669..2d5dc2acf0 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el @@ -241,37 +241,31 @@ 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 () +(defun 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)) +(make-obsolete 'eshell-add-to-window-buffer-names + "no longer needed." "24.2") -(defsubst eshell-remove-from-window-buffer-names () +(defun 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))) +(make-obsolete 'eshell-remove-from-window-buffer-names + "no longer needed." "24.2") (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) +(defcustom eshell-unload-hook '(eshell-unload-all-modules) "A hook run when Eshell is unloaded from memory." :type 'hook :group 'eshell) (defcustom eshell-buffer-name "*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) @@ -307,13 +301,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 (cl-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/progmodes/python.el b/lisp/progmodes/python.el index 310bb8d3f6..f695d74748 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1549,16 +1549,12 @@ virtualenv." If DEDICATED is t and the variable `buffer-file-name' is non-nil returns a string with the form `python-shell-buffer-name'[variable `buffer-file-name'] else -returns the value of `python-shell-buffer-name'. After -calculating the process name adds the buffer name for the process -in the `same-window-buffer-names' list." +returns the value of `python-shell-buffer-name'." (let ((process-name (if (and dedicated buffer-file-name) (format "%s[%s]" python-shell-buffer-name buffer-file-name) (format "%s" python-shell-buffer-name)))) - (add-to-list 'same-window-buffer-names (purecopy - (format "*%s*" process-name))) process-name)) (defun python-shell-internal-get-process-name () -- 2.20.1