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: Fri, 1 Sep 2023 22:17:30 -0700 Message-ID: <98c6ac0f-08fd-8dd0-2213-8a482f5ac67f@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> 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="27760"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65604@debbugs.gnu.org, me@eshelyaron.com To: Davide Masserut , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 02 07:18:09 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 1qcJ1N-00071Q-C0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 02 Sep 2023 07:18:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcJ1F-0005S4-Fn; Sat, 02 Sep 2023 01:18:01 -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 1qcJ17-0005Rl-8E for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 01:17:54 -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 1qcJ17-0006qT-0l for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 01:17:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qcJ1G-0003Lj-HR for bug-gnu-emacs@gnu.org; Sat, 02 Sep 2023 01:18:02 -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 05:18: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.169363186912857 (code B ref 65604); Sat, 02 Sep 2023 05:18:02 +0000 Original-Received: (at 65604) by debbugs.gnu.org; 2 Sep 2023 05:17:49 +0000 Original-Received: from localhost ([127.0.0.1]:34898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcJ13-0003LI-By for submit@debbugs.gnu.org; Sat, 02 Sep 2023 01:17:49 -0400 Original-Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]:61807) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcJ11-0003L6-Cg for 65604@debbugs.gnu.org; Sat, 02 Sep 2023 01:17:47 -0400 Original-Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-5732481b22eso1752146eaf.3 for <65604@debbugs.gnu.org>; Fri, 01 Sep 2023 22:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693631852; x=1694236652; 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=nStdIKCJ4tD1x7LNH5eXEmRGpKESfdc8yI0fgzJ8Jd0=; b=ik0zJ2Rc1cHCKAQyEp1qw63Y4RVLhhUFYny6ypv971cxYfGoUY8cLpE6NwbBlbEcUU CYn6uWy+M50IV1J6rJzIxfTeg6RoH+OhZcPj2dHjbKr20N9TY5d/KrVhjdSnn+UUIfwg JKf910FAzSRNM92Oq29wCM3TJcp4S4Nu6v1pzQAsTZQCYi+Pa9dsJ9pKlwdugwct+ciI u+RbaDtGYjtm9wokAbz9rJ9FMXHdoOGz+rnspZmkbBs4sZjTBmgVhQtSI7/uLQFcJI5S GRNcqTbYV75w/Jt8nauxUs+jQw6kK0tBGE4X8s+glS6fZf9rFYQEayfyWla5ex19/oWo nCRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693631852; x=1694236652; 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=nStdIKCJ4tD1x7LNH5eXEmRGpKESfdc8yI0fgzJ8Jd0=; b=NYmFMXtT82XY3c7hZ3/wwoavEl+6fx+eBAxCp9aemiEmZMKiXLCQLRFwPLmbJrlFB7 5SsNJekNsbbuVWKGHO/eVWi3bvVlb0kBTLe5UbyOi4xSkPaO+2grDhdtKHO0CE1g9B3M 6M7GoezcfS+8CD81stS5rmp2MXYOcv0qP6T8JzLxizCZwd/6plqknNqpZwuwFD1A9bge JN99aRtatF2FRMAFqSKWw2NgwPPBBxXwT34OwB1rts5SSSWeDOk1G1Zn+M1NMCyZoqXn PQ4vZUQDh7JfSx8EBMlHANifsMxtj/dFz4ZKcr+Ro3knIMFiXoMDrt7WjwrGyM2fAGtk aqhA== X-Gm-Message-State: AOJu0YzuxR7yRAG9LF2SoXmVwx7kgsXMQ8EAwaZEjPGTkbM5ecVJ4PTz Rp1yXdIOtHLvBZMvvr4LnnU= X-Google-Smtp-Source: AGHT+IF8XcJeXNMrr23oLt4rLPTB3oIRwkjopaNxCGyQzhv69/7hxucPBzL5HfDF5BDdjigecrV95g== X-Received: by 2002:a05:6808:2091:b0:3a5:a607:650d with SMTP id s17-20020a056808209100b003a5a607650dmr5731456oiw.45.1693631852084; Fri, 01 Sep 2023 22:17:32 -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 x7-20020a63b207000000b00563df2ba23bsm3746727pge.50.2023.09.01.22.17.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Sep 2023 22:17:31 -0700 (PDT) Content-Language: en-US In-Reply-To: <87cyz38rj2.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:268953 Archived-At: On 8/31/2023 2:31 AM, Davide Masserut via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: >> (FWIW, I personally don't like the idea of showing this on the mode >> line: the mode line is already quite cramped > > I agree with you, this is one of the main reasons I had in mind when I > made the first patch. 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. 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 like "!!" in 'eshell-command-finished'. That's not as useful as the 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 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 think about that? >> 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. In any case, sorry for the back and forth. This is another corner of Eshell I wasn't really aware of until this bug, so I'm not 100% sure what implementation follows the spirit of Eshell the most...