--- Begin Message ---
Subject: |
[PATCH] Display the exit code if the last command failed in Eshell |
Date: |
Wed, 30 Aug 2023 00:24:28 +0200 |
Tags: patch
There are commands that fail without printing any messages, but
set specific error codes.
This patch extends the default prompt function to show the exit
code of the previous failed command.
Before:
~ $ false
~ $
After:
~ $ false
~ [1] $
I believe this is a good default, since it is displayed only when
a error occurs and hopefully makes debugging easier by showing the
error code without further input.
In GNU Emacs 30.0.50 (build 10, x86_64-pc-linux-gnu, GTK+ Version
3.24.38, cairo version 1.17.8) of 2023-08-29 built on T480s
Repository revision: ed77dc17f657d99ccf23778c14f06f7226f478f0
Repository branch: master
System Description: Arch Linux
Configured using:
'configure -C --prefix /home/davide/.local --with-pgtk
--with-native-compilation --enable-link-time-optimization
--enable-locallisppath=/usr/share/emacs/site-lisp/
'CFLAGS=-march=native -O2''
0001-Display-the-exit-code-if-the-last-command-failed-in-.patch
Description: Text Data
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#65604: [PATCH] Display the exit code if the last command failed in Eshell |
Date: |
Sat, 2 Sep 2023 15:46:11 -0700 |
Version: 30.1
On 9/2/2023 11:54 AM, Davide Masserut via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
Jim Porter <jporterbugs@gmail.com> writes:
The prompt regexp is (thankfully) almost irrelevant in Emacs 30
now. It only matters for paragraph-movement commands, which we could
probably just remap to the actual Eshell-specific commands to navigate
forward and backward through the prompts. I should probably just make
a patch for this and finally get rid of that regexp entirely.
I didn't know that, thanks.
I've now made it fully-obsolete, so it doesn't do anything anymore (now,
Eshell implements its own paragraph navigation based on fields).
Sorry, I meant that if we decided to show a relative long message like
"Running" in the mode-line, then we should show it only when it lasts
for more than, let's say, 0.5s. This would prevent the mode-line from
moving to right for just a fraction of a second when running fast
commands like cd or ls.
Hmm, that's true. One benefit of the current mode-line implementation
for Eshell is that the indicator always takes up the same width. I'll
keep thinking about this.
... in any case, maybe the simplest way forward here is to put the
(non-zero) exit status in the prompt like your original patch, and
then separately, I can try to improve the customizability of the
prompt, as well as thinking about what to do with the mode-line.
I have updated the patch.
Thanks. I rebased it on top of my changes and pushed it to master as
3d08d0dd80a. Closing this bug now.
--- End Message ---