From 57f56f2cf150a918ad4e258475433b9b950f2fc0 Mon Sep 17 00:00:00 2001 From: Ken Manheimer Date: Tue, 26 Jan 2016 13:11:37 -0500 Subject: [PATCH] multishell - don't skip cd when restarting local shells; note new starts Shaking out implementation of shell launch decision tree. --- multishell.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/multishell.el b/multishell.el index f4cfb9f5c..c9b10502b 100644 --- a/multishell.el +++ b/multishell.el @@ -408,9 +408,11 @@ customize the savehist group to activate savehist." (not (setq inwin (multishell-get-visible-window-for-buffer target-buffer)))) ;; No preexisting shell buffer, or not in a visible window: + (when (not (get-buffer target-shell-buffer-name)) + (message "Creating new shell buffer '%s'" target-shell-buffer-name)) (pop-to-buffer target-shell-buffer-name pop-up-windows)) - ;; Buffer exists and already has a window - jump to it: + ;; Buffer exists and already has a window - jump to it: (t (if (and multishell-pop-to-frame inwin (not (equal (window-frame (selected-window)) @@ -551,19 +553,21 @@ and path nil if none resolved." (defun multishell-start-shell-in-buffer (buffer-name path) "Start, restart, or continue a shell in BUFFER-NAME on PATH." (let* ((buffer (get-buffer buffer-name)) - is-remote) + is-remote is-active) (set-buffer buffer) + (setq is-active (comint-check-proc buffer)) (when (and path (file-remote-p path)) (when (and (derived-mode-p 'shell-mode) - (not (comint-check-proc (current-buffer)))) + (not is-active)) ;; Returning to disconnected remote shell. Do some tidying: (tramp-cleanup-connection (tramp-dissect-file-name default-directory 'noexpand) - 'keep-debug 'keep-password)) + 'keep-debug 'keep-password))) + (when (and path (not is-active)) (message "Connecting to %s" path) (cd path)) -- 2.39.2