]> code.delx.au - gnu-emacs-elpa/commitdiff
Merge commit '2c5d608ddfeb2dc1acc15d645d94cac087f001d4'
authorKen Manheimer <ken.manheimer@gmail.com>
Tue, 19 Jan 2016 06:47:32 +0000 (01:47 -0500)
committerKen Manheimer <ken.manheimer@gmail.com>
Tue, 19 Jan 2016 06:47:32 +0000 (01:47 -0500)
packages/multishell/multishell.el

index e6924e81112c862be8f163b3ab49f0764b72cc1e..e23813d25144073e0320ad4dd2e461cf2a4a21f0 100644 (file)
@@ -1,4 +1,4 @@
-;;; multishell.el --- facilitate use of multiple local and remote shell buffers
+;;; multishell.el --- facilitate multiple local and remote shell buffers
 
 ;; Copyright (C) 1999-2016 Free Software Foundation, Inc. and Ken Manheimer
 
@@ -175,11 +175,18 @@ emacs sessions."
 (defun multishell-register-name-to-path (name path)
   "Add or replace entry associating NAME with PATH in `multishell-history'.
 
-Promote to added/changed entry to the front of the list."
+If NAME already had a PATH and new PATH is empty, retain old one.
+
+Promote added/changed entry to the front of the list."
   ;; Add or promote to the front, tracking path changes in the process.
   (let* ((entries (multishell-history-entries name))
-         (becomes (concat name path)))
+         (becomes (concat name path))
+         oldpath)
     (dolist (entry entries)
+      (when (or (not path) (string= path ""))
+        ;; Retain explicit established path.
+        (setq path (cadr (multishell-split-entry-name-and-tramp entry))
+              becomes (concat name path)))
       (setq multishell-history (delete entry multishell-history)))
     (setq multishell-history (push becomes multishell-history))))