bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65604: [PATCH] Display the exit code if the last command failed in E


From: Eli Zaretskii
Subject: bug#65604: [PATCH] Display the exit code if the last command failed in Eshell
Date: Thu, 31 Aug 2023 07:52:16 +0300

> From: Davide Masserut <dm@mssdvd.com>
> Cc: me@eshelyaron.com, 65604@debbugs.gnu.org, jporterbugs@gmail.com
> Date: Wed, 30 Aug 2023 21:59:35 +0200
> 
>      Unless SYMBOL is marked as risky (i.e., it has a non-‘nil’
>      ‘risky-local-variable’ property), all text properties 
>      specified in
>      SYMBOL’s value are ignored.  This includes the text 
>      properties of
>      strings in SYMBOL’s value, as well as all ‘:eval’ and 
>      ‘:propertize’
>      forms in it.  (The reason for this is security: non-risky 
>      variables
>      could be set automatically from file variables without 
>      prompting
>      the user.)
> 
> 
> Given this code:
> 
>   (defun eshell-mode-line-exit-code ()
>     (when (> eshell-last-command-status 0)
>       (propertize
>        (format ":[%s]" eshell-last-command-status)
>        'help-echo (format "Last command exited with code %s"
>                           eshell-last-command-status)
>        'face 'compilation-mode-line-fail)))
> 
>   (setq-local mode-line-process 'eshell-mode-line-exit-code)
> 
> Doesn't it mean that unless we mark it "risky-local-variable", 
> Emacs will remove the "compilation-mode-line-fail" face?

Ah, that.  Yes, the properties will be ignored.  But do we really need
fancy faces on that display?

(FWIW, I personally don't like the idea of showing this on the mode
line: the mode line is already quite cramped, and OTOH Bash does show
abnormal exit codes as part of its prompt.  But feel free to disregard
my opinions, as I'm not a heavy user of Eshell.)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]