From 25b22772a7149a5207e4693f149718329a25e135 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 4 Apr 2018 23:43:54 +0300 Subject: [PATCH] * lisp/shell.el (shell-mode): Check if buffer has a live process. (Bug#31028) --- lisp/shell.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/shell.el b/lisp/shell.el index 5c228a5eba9..d4a0556ceb3 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -568,8 +568,10 @@ buffer." (setq list-buffers-directory (expand-file-name default-directory)) ;; shell-dependent assignments. (when (ring-empty-p comint-input-ring) - (let ((shell (file-name-nondirectory (car - (process-command (get-buffer-process (current-buffer)))))) + (let ((shell (if (get-buffer-process (current-buffer)) + (file-name-nondirectory + (car (process-command (get-buffer-process (current-buffer))))) + "")) (hsize (getenv "HISTSIZE"))) (and (stringp hsize) (integerp (setq hsize (string-to-number hsize))) -- 2.39.2