From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Davide Masserut via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65604: [PATCH] Display the exit code if the last command failed in Eshell Date: Sat, 02 Sep 2023 10:47:15 +0200 Message-ID: <87msy4yl2c.fsf@mssdvd.com> References: <87cyz5wjtm.fsf@mssdvd.com> <05108d35-d095-c975-78b8-6b00fc7e6a08@gmail.com> <87o7iolg6o.fsf@mssdvd.com> <83v8cwfphy.fsf@gnu.org> <87wmxc4ah3.fsf@mssdvd.com> <83fs40fi35.fsf@gnu.org> <87msy8s344.fsf@mssdvd.com> <83a5u7g6f3.fsf@gnu.org> <87cyz38rj2.fsf@mssdvd.com> <98c6ac0f-08fd-8dd0-2213-8a482f5ac67f@gmail.com> Reply-To: Davide Masserut Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33930"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65604@debbugs.gnu.org, Eli Zaretskii , me@eshelyaron.com To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 02 11:36:13 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qcN36-0008cn-MS for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Sep 2023 11:36:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcN2o-0001kO-7c; Sat, 02 Sep 2023 05:35:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcN2n-0001kE-A8 for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 05:35:53 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qcN2n-0002cF-0W for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 05:35:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qcN2w-000715-6r for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 05:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Davide Masserut Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Sep 2023 09:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65604-submit@debbugs.gnu.org id=B65604.169364734826946 (code B ref 65604); Sat, 02 Sep 2023 09:36:02 +0000 Original-Received: (at 65604) by debbugs.gnu.org; 2 Sep 2023 09:35:48 +0000 Original-Received: from localhost ([127.0.0.1]:35231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcN2h-00070Y-J6 for submit@debbugs.gnu.org; Sat, 02 Sep 2023 05:35:48 -0400 Original-Received: from out-235.mta0.migadu.com ([91.218.175.235]:41614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcN2f-00070N-8O for 65604@debbugs.gnu.org; Sat, 02 Sep 2023 05:35:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mssdvd.com; s=key1; t=1693647334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5jAvKYrNS/eyl+EOzzlh6Ua9ploQONc3eby135+9/pY=; b=dTk8nlcrFBSmZzFIZ0vqFns8ZfU7GYlpS1hJTdUG8xq1ssNN52OKP/fkRKjVc6i9NIr4Wl fC9QDtnPWd1qTTRT2pNbOrLkMxLkHucvFOd/B/njmFaCJi9MUX8VLTG+uTHq4a9NyAGDap KYIknLFEG+VBqYeqiFZzhNwmiiq2KSBhFvSgHS2icvS48A1jJUKPZTgM9Uigo6hhEQXsmJ FsUIW9rnf4ttsfqyT17SunTIZyiW6Zly38zz/jf5HyNZUBsZcLN1uY4xaM3XJTwy85yLVX n+3syqt9BHTk74cp8rNXH0AcD7hzhja8qSmRHycEmzpTIrmd3uiOWzDlzDSRdQ== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <98c6ac0f-08fd-8dd0-2213-8a482f5ac67f@gmail.com> X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268975 Archived-At: Jim Porter writes: > Hmm, well if everyone else disagrees, I suppose I don't see any > *major* issues with including the exit status in the prompt, though > I'm a little worried it would annoy people who like the current > way. If it were easier to customize the prompt, I don't think I'd be > as worried. Fixing that for real is probably beyond the scope of=20 > this > bug, but I do have a WIP patch for it. What do you find difficult to customize? I can only think of two things: 1) The default function is quite simple, but displaying the bytecode=20 in customization buffer can be confusing. Hide Eshell Prompt Function: Function: #[0 "\300\301 !\302 \303U\203\0\304\202\0\305P\207" [abbreviate-file-name eshell/pwd file-user-uid 0 " # " " $ "] 3] State : STANDARD. A function that returns the Eshell prompt string. Hide Make sure to update =E2=80=98eshell-prompt-regexp=E2=80=99 so that it wi= ll match=20 your prompt. 2) It may require to update the regexp. Can we use rx to make it more understandable? > If we do use the mode-line to display this though, I was initially > thinking we could use the existing variable > 'eshell-command-running-string', which we could set to something=20 > like > "!!" in 'eshell-command-finished'. That's not as useful as the=20 > actual > number though, and honestly I'm not sure the current > 'eshell-status-in-mode-line' code is a good idea anyway. It > (buffer-locally) replaces the mode-line construct immediately after > 'mode-line-front-space', which means you lose some of the > potentially-useful information there. > > Maybe it would make sense to move *all* of the current Eshell > mode-line stuff to the 'mode-line-process' construct. That seems=20 > like > it would be less brittle. That is, in 'mode-line-process', we could > show whether a command is running or the exit status if nothing's > running (possibly including successful exit). What does everyone=20 > think > about that? In this case I would add a small delay before signaling that something=20 is running. However, I'm not sure it is so useful to signaling it. When I suspect that the process is hanging, I usually use tools like=20 top or proced to check if something is stuck, but otherwise I already=20 know something is going on. I believe some terminals update the title bar when something is=20 running and send a notification when process ends and the window is=20 not focused. But for such long operations compilation-mode works best for me (BTW,=20 thank you for the new compile command). >>> 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.) >> fish and some zsh distributions also show the error in the prompt. > > Do they? I tried to see what the default was for Bash and after some > searching, it seemed that it doesn't show the exit status by > default. But that could be wrong. Distros often change the default prompt.