Subject: bug#39705: 28.0.50; mode-line-process in comint-redirect-setup

From: Juri Linkov <[email-masked]>
Date: Fri, 21 Feb 2020 01:45:36 +0200

Tags: patch

I customized mode-line-process to highlight its status with a color

(add-hook 'comint-mode-hook
          (lambda ()
            (require 'compile)
            (setq mode-line-process
                  '(:propertize ":%s" face compilation-mode-line-fail))))

as was recommended in http://thread.gmane.org/gmane.emacs.devel/153647/focus=153682

But comint.el signals an error because it expects mode-line-process to be
in its default value.  I don't know how to make mode-line customization
to be less brittle, but at least this case can be fixed by:

diff --git a/lisp/comint.el b/lisp/comint.el
index 5c521ff0fd..ea06f8af87 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3641,7 +3641,7 @@ comint-redirect-setup
     (setq-local comint-redirect-previous-input-string "")
 
     (setq mode-line-process
-	  (if mode-line-process
+	  (if (and mode-line-process (stringp (elt mode-line-process 0)))
 	      (list (concat (elt mode-line-process 0) " Redirection"))
 	    (list ":%s Redirection")))))