From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#65604: [PATCH] Display the exit code if the last command failed in Eshell Date: Sat, 2 Sep 2023 11:40:53 -0700 Message-ID: <1f740d2f-ee68-7157-b6bb-d2725c9c67c3@gmail.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> <87msy4yl2c.fsf@mssdvd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38870"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65604@debbugs.gnu.org, Eli Zaretskii , me@eshelyaron.com To: Davide Masserut Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 02 20:42:12 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 1qcVZT-0009uM-0v for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Sep 2023 20:42:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcVZC-0004Pi-7y; Sat, 02 Sep 2023 14:41: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 1qcVZA-0004OW-5v for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 14:41:52 -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 1qcVZ9-0006Sg-UQ for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 14:41:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qcVZJ-0001l6-PH for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 14:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Sep 2023 18:42:01 +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.16936800716702 (code B ref 65604); Sat, 02 Sep 2023 18:42:01 +0000 Original-Received: (at 65604) by debbugs.gnu.org; 2 Sep 2023 18:41:11 +0000 Original-Received: from localhost ([127.0.0.1]:38643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcVYU-0001k2-GZ for submit@debbugs.gnu.org; Sat, 02 Sep 2023 14:41:10 -0400 Original-Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:53560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcVYS-0001jq-W2 for 65604@debbugs.gnu.org; Sat, 02 Sep 2023 14:41:10 -0400 Original-Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c1e3a4a06fso590385ad.3 for <65604@debbugs.gnu.org>; Sat, 02 Sep 2023 11:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693680053; x=1694284853; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=BmfgzRWAGmUtf0M1y+urMo824JWJxYD+o2AO6ZrXB3o=; b=f1eogGeK8m7kpv0eGosOuQ23OfPq6r+lVbe8lfH3wKNwnJs97h4D7VAhPitratfIRP BUAta2jlE5P+d3a47exD4GOl3gPVcIaNWFYBApDy56VdnD08jIKJRh+hk60rQS9/39Z3 vRyIVymef6Z45k5IcFVECIulRmkq1ZpGD8tCRgpSX9+nsBmBXPg0VpB8WFodVzjfj1U7 zCZWsE0Ijphmab+15ePBLGRbcW0EgOlMNcWtwQEolVv0ym63wbRZpA59+Tq0faE28JNa Q7H4Scn5L5GsEjHtUMF40BPINYMLqrv7MZAi+IWg5yAfdzMr12lvSK0JLCG1WDuNWFad PVFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693680053; x=1694284853; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BmfgzRWAGmUtf0M1y+urMo824JWJxYD+o2AO6ZrXB3o=; b=a4OcYrPTzAr9o0VrclvW9G9v45rAX3UaFx5mQJ/9xRUVhuMIrdDpQUrzGq9iYErGhv j10IOw4kNnBRwfmVyv+p1UzPc96ocNssWqP9jwee4WCM71J+c13vD3S/LMg7hY2GujX8 YgcAJfKWX/P+tKYjGPXm8nj7/7BgeGkk511QEscSnlM5GasWSf9BRMhp2zCWIfT0Exjl d+98JE0Jd/fxcpiVrRLJN702FxZjC6bwc+jhGfFrlb/5IFG729AicDYYvHZYjighwD0n XkYUsM8Bq/wyqKrR4kkhDEzpAtlCP6UQkVnZ6qstkWSQnN+hryiR03Q1ExGwEHFnl4ad U/OQ== X-Gm-Message-State: AOJu0YwOmrFzovHbLbWQitFYOeWrMOudY/2RD8GbQQnRiTRyVda0cape 09momcgpqJ0RAcdtx9b0NYY= X-Google-Smtp-Source: AGHT+IGA3mQNjnOr6fWdqRqquT0FjJ9iPGHIJG1El52oXOAzFJAxnfmrMzQul57RZpUgm5+FZR3Nhw== X-Received: by 2002:a17:903:1210:b0:1bb:994c:bc43 with SMTP id l16-20020a170903121000b001bb994cbc43mr6264924plh.18.1693680053063; Sat, 02 Sep 2023 11:40:53 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id je7-20020a170903264700b001a9b29b6759sm4928932plb.183.2023.09.02.11.40.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 02 Sep 2023 11:40:52 -0700 (PDT) Content-Language: en-US In-Reply-To: <87msy4yl2c.fsf@mssdvd.com> 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:269041 Archived-At: On 9/2/2023 1:47 AM, Davide Masserut via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > 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 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 in > customization buffer can be confusing. Yeah, mainly the Customize interface. It's a bit confusing, and when I think back to when I didn't understand Elisp, I would have found any customization of the Eshell prompt to be pretty intimidating. I have a WIP patch for this though, which uses 'mode-line-format' to make the Eshell prompt work more like the mode-line. It seems to work pretty well, but I need to finish it up. (And especially to make sure it doesn't do anything weird with multi-line prompts.) > 2) It may require to update the regexp. 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. > In this case I would add a small delay before signaling that something > is running. The delay isn't present in the current Eshell mode-line implementation, and I don't think anyone's raised an issue about that... > 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 top > or proced to check if something is stuck, but otherwise I already know > something is going on. I think there's some use, especially for longer-running Lisp functions, but that area is a bit of a mess anyway since it's tough to run Lisp code asynchronously (or at least, in a way that meshes with Eshell). > I believe some terminals update the title bar when something is running > and send a notification when process ends and the window is not focused. > But for such long operations compilation-mode works best for me (BTW, > thank you for the new compile command). Yeah, this is roughly what I'm thinking for Eshell. The mode-line seems to me like a decent place for that info. >> 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. Yeah, I tried to take that into account when I looked it up. The actual default from GNU Bash is *very* basic, but what you get as a fresh user on most distros is a little fancier. I didn't see that it reported the exit status though. ... 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.