From: Chong Yidong Date: Fri, 10 Aug 2012 16:46:07 +0000 (+0800) Subject: Remove some unnecessary bindings of same-window-* variables. X-Git-Tag: emacs-24.2.90~734 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1530c98e56d331a21ba7ef2c940d1441442ac798;p=emacs.git 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b6649d4b37d..bc270b8bdb2 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 a1717756696..2d5dc2acf05 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 310bb8d3f66..f695d747483 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 ()