Shaking out implementation of shell launch decision tree.
(not (setq inwin
(multishell-get-visible-window-for-buffer target-buffer))))
;; No preexisting shell buffer, or not in a visible window:
(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))
(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))
(t (if (and multishell-pop-to-frame
inwin
(not (equal (window-frame (selected-window))
(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))
(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))
+ (setq is-active (comint-check-proc buffer))
(when (and path (file-remote-p path))
(when (and (derived-mode-p 'shell-mode)
(when (and path (file-remote-p path))
(when (and (derived-mode-p 'shell-mode)
- (not (comint-check-proc (current-buffer))))
;; Returning to disconnected remote shell. Do some tidying:
(tramp-cleanup-connection
(tramp-dissect-file-name default-directory 'noexpand)
;; 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))
(message "Connecting to %s" path)
(cd path))