diff --git a/lisp/shell.el b/lisp/shell.el index e6b315ee5c0..ca02d602966 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -720,9 +720,10 @@ shell-mode ;; edit this directory. But it is useful in the buffer list and menus. (setq list-buffers-directory (expand-file-name default-directory)) ;; shell-dependent assignments. - (when (ring-empty-p comint-input-ring) + (when (and (ring-empty-p comint-input-ring) + shell--start-prog) (let ((remote (file-remote-p default-directory)) - (shell (or shell--start-prog "")) + (shell shell--start-prog) (hsize (getenv "HISTSIZE")) (hfile (getenv "HISTFILE"))) (when remote