Remove some unnecessary bindings of same-window-* variables.
authorChong Yidong <cyd@gnu.org>
Fri, 10 Aug 2012 16:46:07 +0000 (00:46 +0800)
committerChong Yidong <cyd@gnu.org>
Fri, 10 Aug 2012 16:46:07 +0000 (00:46 +0800)
* 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
lisp/eshell/eshell.el
lisp/progmodes/python.el

index b6649d4..bc270b8 100644 (file)
@@ -1,3 +1,13 @@
+2012-08-10  Chong Yidong  <cyd@gnu.org>
+
+       * 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  <cyd@gnu.org>
 
        * bindings.el: Bind M-= back to count-words-region.
index a171775..2d5dc2a 100644 (file)
@@ -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))
index 310bb8d..f695d74 100644 (file)
@@ -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 ()