GNU bug report logs - #80689
[PATCH 2/2] add shell-command-finished-hook

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: scmorris.dev@HIDDEN; Keywords: patch; dated Sun, 29 Mar 2026 22:49:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 9 Apr 2026 06:11:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 09 02:11:23 2026
Received: from localhost ([127.0.0.1]:36452 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAibq-0001p5-OY
	for submit <at> debbugs.gnu.org; Thu, 09 Apr 2026 02:11:23 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:54182)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wAibp-0001on-9z
 for 80689 <at> debbugs.gnu.org; Thu, 09 Apr 2026 02:11:21 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1wAibj-0000FA-QG; Thu, 09 Apr 2026 02:11:15 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=MgTaBLRYfCP5cT2iXQRyg+PLZL7BCvqGJUgb9Xz/vMk=; b=ad1+5j3wOxCN
 arnaN+OE8+NPG3RTVOIiuXCJybcrDf99HV3k61xMzCuE0mECsrpivQDy2LlimUvI3KQYuwSIj8N9b
 miAxU5v0YiqTmKrZ0HWJk0459RyaWPX+HPUt9zLxf4oX3DmfMhkJhAA96Q9Ol93wO6ajL8qH5MtEr
 PjvEvjz/9zyi8ztKCCOLGN0wZaiaZGAtVwpZXJ3iru3mgcLOl8Lp4TEvXnJaMbEuPYFExYenfSZ3B
 4+98EqaKniaGIzuFd3h8zV2EmIYLc65+L0JLhC0vNII9foRXUc8kp8yxdP0GsNWjxdhCkYN/tx9ZW
 KIomGITnR8Z3BH7dZj1MCA==;
Date: Thu, 09 Apr 2026 09:11:12 +0300
Message-Id: <864ilkwtmn.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: scmorris.dev@HIDDEN
In-Reply-To: <6fb46e1d680841357a8cdc6820b5dec61cb11d1e.1775602725.git.scmorris.dev@HIDDEN>
Subject: Re: bug#80689: [PATCH v3 1/2] add optional SENTINEL argument to
 shell-command
References: <875x649wjt.fsf@HIDDEN>
 <6fb46e1d680841357a8cdc6820b5dec61cb11d1e.1775602725.git.scmorris.dev@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: "S.C. Morris" <scmorris.dev@HIDDEN>
> From: scmorris.dev@HIDDEN
> Date: Tue,  7 Apr 2026 17:08:01 -0600
> 
> From: "S.C. Morris" <scmorris.dev@HIDDEN>
> 
> * lisp/simple.el (shell-command, async-shell-command): Add optional
> SENTINEL argument, passed to `set-process-sentinel' for asynchronous
> commands instead of `shell-command-sentinel'.
> 
> * lisp/net/tramp.el (tramp-handle-shell-command): Likewise.
> 
> * etc/NEWS: Document new SENTINEL argument.
> ---
>  etc/NEWS          |  6 ++++++
>  lisp/net/tramp.el |  4 ++--
>  lisp/simple.el    | 14 +++++++++-----
>  3 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/etc/NEWS b/etc/NEWS
> index 0bdd2c9b84d..5c4f9e10f03 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -4325,6 +4325,12 @@ buffer.  The buffer name is derived from the command string, using
>  'shell-command-buffer-name' or 'shell-command-buffer-name-async' as
>  a prefix.
>  
> ++++
> +** 'shell-command' and 'async-shell-command' accept a new optional SENTINEL arg.

Once again, this cannot be marked "+++" without suitable patches for
the manual(s).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 7 Apr 2026 23:08:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 19:08:17 2026
Received: from localhost ([127.0.0.1]:43695 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAFWr-0008GO-Fu
	for submit <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:08:17 -0400
Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]:42303)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <scmorris.dev@HIDDEN>)
 id 1wAFWi-0008Ff-GU
 for 80689 <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:08:09 -0400
Received: by mail-ot1-x335.google.com with SMTP id
 46e09a7af769-7d9b21d1461so370931a34.1
 for <80689 <at> debbugs.gnu.org>; Tue, 07 Apr 2026 16:08:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1775603287; x=1776208087; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=7QCqnGjFD6+p8ya1ov6SKifTNkjfpies/ufJSmivAcw=;
 b=PFNRFL7z5l5Fu5e3VnTgZc5wK+4hIkmIbUGKUvai0fK1MG8eRPSgvBGgy4zwtsPG2J
 zrmpAVs28kpyR2wf+EBktrrnSoZH5NPJbm+fmS6ycGeDp5XC0V2tkFoMf8//FhTuUy2s
 WzMKukKJ6w92kfNLB5byzk6tVRlO2f+LnT6Bi6iFM8pXMk9Viwl4O9M03n0cElFZEZrD
 XZD8LU/3c8jTOVXGpyEp+Nnj3t4OZ0Wwl1jzXkvma0cGKB7bfyktcLyxqbX0pz3TD978
 o6ox7dCuyaB5QbZLkauwgPSA7ACqGxd523dodCKcOJy2Puqwe1J7VOLRkB4iQGh2rd1M
 cCpQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1775603287; x=1776208087;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=7QCqnGjFD6+p8ya1ov6SKifTNkjfpies/ufJSmivAcw=;
 b=PKPNgb2Co7rJPfLhq7z+w53pW6PhfvknzdUePZXWTGt/typIKG24pvMabT5PuTCMXl
 pnr/PiXHDwFr4KBYPk/Fb1J7s++k20gH6C4OH9RsKwwhLnn2h8fXdW4elltvYfBCRN+M
 9S5840zHd4ynFDWo4f/erMNI+g3WoLdVq8eyaqnUHylXMGI35yDith04fV/VS+DqbFAd
 KQI6/lw4qG71Lfrhg4jDqub5R7mS/o4nY1QN5oDuAvQvOEua8+/suUwJzpbJ7gn3z9zr
 XzvW4VPTq7tSc7OhciNqL41ysuAc462a4+xAWQx9w+AfgNsUU44wPxNDc9bC8w+nILmE
 GrNQ==
X-Gm-Message-State: AOJu0YxyB2zIjCjf7BdRsQp3On0KI68oeqwv3dpfQAdVcaGRQFBEm4jh
 FX/Ppt/3N21mTjdivMNmBbp30XV1+kI5Rc+IVoKogJX4Ok5+QY9gaCv5K9edBXQCZk8=
X-Gm-Gg: AeBDieuqafmQUM/INbfW57WQuOtRQuao4C86jvAsih2jrXVyG9rWdKNhTHHGSv8zgwI
 fO1P1XxWFNgxyNwDybNsQH7x8g8GDV/FzQboMVl5NwbuaJegGYOD4GzGmXIFHk+fdlzOftMRTBh
 LpqttjZe7lLjSVKw3jdpVv8WAhRwQW59h+dyy72RUsYWCOrModcAxuEb2NqZFi3n4p5LXB4BTwi
 OLYpM9kEwx+6q5oTvh9/ioMcvvTeJ1ZXuqMnaHFpoEYMglKx04kAJl/zIZEkOu24/dyPTplL88f
 sb1YdUYzUBPULjsRSJr+bS2xuHjfoa3tf4Ju6SXJmZU+lWRJljPyahsGcuhLpHYoWh4m8CeCDHS
 WIjXSGbiQOAi8V+A9lkbY1FM5+2IZj0KDwogEGfgxqJHcj4Mh+rFixqS5mbISSsCova7Vbe1f5G
 G/0RcRL5MhgYBUkXaEZcINuicbbiI=
X-Received: by 2002:a05:6830:3497:b0:7db:cade:d008 with SMTP id
 46e09a7af769-7dbcaded89amr8701593a34.2.1775603287144; 
 Tue, 07 Apr 2026 16:08:07 -0700 (PDT)
Received: from envy.hsd1.co.comcast.net ([2601:282:1d00:ad10::7451])
 by smtp.gmail.com with ESMTPSA id
 46e09a7af769-7dbc54ba910sm9100178a34.14.2026.04.07.16.08.06
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 07 Apr 2026 16:08:06 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: 80689 <at> debbugs.gnu.org
Subject: [PATCH v3 2/2] make shell-command return the process for async
 commands
Date: Tue,  7 Apr 2026 17:08:02 -0600
Message-ID: <e6dcae5880be08f8b31b779f8526c2a00f5199a7.1775602725.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <875x649wjt.fsf@HIDDEN>
References: <875x649wjt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80689
Cc: "S.C. Morris" <scmorris.dev@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

From: "S.C. Morris" <scmorris.dev@HIDDEN>

* lisp/simple.el (shell-command): Return the process object when
running asynchronously.  Previously the return value was the result
of `display-buffer' (a window), which was undocumented.  Callers
can use `process-buffer' to get the output buffer and
`get-buffer-window' to get the window.

Note: `tramp-handle-shell-command' already returns the process for
async commands via `prog1', so no change is needed there.

* etc/NEWS: Document the new return value.
---
 etc/NEWS       | 7 +++++++
 lisp/simple.el | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 5c4f9e10f03..1f422a54146 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4325,6 +4325,13 @@ buffer.  The buffer name is derived from the command string, using
 'shell-command-buffer-name' or 'shell-command-buffer-name-async' as
 a prefix.
 
++++
+** 'shell-command' now returns the process for async commands.
+When the command ends with '&', 'shell-command' now returns the process
+object.  Previously it returned the result of 'display-buffer' (a
+window), which was undocumented and not useful.  The window and output
+buffer remain accessible via 'get-buffer-window' and 'process-buffer'.
+
 +++
 ** 'shell-command' and 'async-shell-command' accept a new optional SENTINEL arg.
 When non-nil, it is used as the process sentinel for the asynchronous
diff --git a/lisp/simple.el b/lisp/simple.el
index b917d081831..e075f962744 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4832,7 +4832,8 @@ shell-command
                                         (remove-function (process-filter proc)
                                                          nonce)
                                         (display-buffer buf '(nil (allow-no-window . t))))))
-                                  `((name . ,nonce)))))))
+                                  `((name . ,nonce)))))
+                proc))))
 	  ;; Otherwise, command is executed synchronously.
 	  (shell-command-on-region (point) (point) command
 				   (or output-buffer
-- 
2.52.0





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 7 Apr 2026 23:08:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 19:08:17 2026
Received: from localhost ([127.0.0.1]:43693 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAFWq-0008GM-SG
	for submit <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:08:17 -0400
Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:58790)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <scmorris.dev@HIDDEN>)
 id 1wAFWh-0008FT-9n
 for 80689 <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:08:07 -0400
Received: by mail-ot1-x334.google.com with SMTP id
 46e09a7af769-7dbff06e4a6so738525a34.1
 for <80689 <at> debbugs.gnu.org>; Tue, 07 Apr 2026 16:08:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1775603286; x=1776208086; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Llr4N1CH308HaRGUBJdDPPuBZ4HARRKgnPxgrkUlIWs=;
 b=VNcVqcqXUpMe7/C0S8HDhsI0QM+UyukqXP4tPGLLdfhLUX9Nm1X9LUAqQMcbwihPff
 eavuEv5TwcGIOlK1bVepcjTbRWByZ2X2S/SiIj8/g7WQeFcYjMLIusuYBQ1k3Py+5I2K
 qF6It9I87bQQnMynnh8N6YQEaxKNAc7NM2SmMUfGdJ0VgvyFC1W9/SuPwqHl+6l4x5jT
 AGwzK5lX7itw/AmnWNFjy4yxFJfc4wutPEgRx7Ty9uSBD5ws9AU8YETHaVL6C8sO4DSO
 Ty3ua+Hb9W6TvXh8RGFqHci3vb05f7etS/V7/tuMnrKY5FO5TxOj6AVWOltwLMP5xFAA
 rWVA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1775603286; x=1776208086;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=Llr4N1CH308HaRGUBJdDPPuBZ4HARRKgnPxgrkUlIWs=;
 b=JGeLRD0PBZGo71TI6p6Lg5AHciEJpXMBIuJB/txOzlU3fmP0mC6EaQ9giLjwZDo6d6
 JHq1qAj+qle7cNi/z8J0wwYERSYcSvrqSWeDmlWN2oCGqv3valRra2G8t3RJicGYfoOY
 PVKth7cx5kBs5P9eMNCSwaYOwweSMD4Nhes1CPpnON6/hXZqddRlABuRYuHKMi8x2Syd
 fun93/8tG/oO17xa/7CwRJ2H3DK8Ox8y98FrQnG/C7dOOtTbMWsmyep5xN6R1Iv2VKba
 bfrFAqcrkDYkSYROzMoKonF/SITtrLeyAMvfod7bR4r24uZ2a1WxWf/zPJ9Tqz9foJnQ
 7nDg==
X-Gm-Message-State: AOJu0YxPFc9utybW5pvbT8Jn4ERHsOi07nIo4D81GKSBi+eTXV4IOBo8
 rBmHqyUrCcmQNgmKV72bbYquz23EATkdIVJ+mGt8+vBDrt2FWQ9H9LXDBDWDJshtVOI=
X-Gm-Gg: AeBDieswUzglGcS2A7ArZdnMByoc8IthCd4pGg/67RNtXntmjgIYnFbvaxFmQfoaT/u
 a44HsnZsT7EWOoZEy4EYFGoW1LrFpMufRrTjCTSxYQLO7yU/c+YCJQRlZVTkc0Lal44mELXpTUd
 XewHrSJz49icd91Fhxa5t80Dzbvz3IbaK3dBbkA8wsi3c84s2uj33uLcQQZXzBSLwyjCYGpLGLT
 gl3WGNKFdSGBikQanDYMcHVR2II9u0/LryLBAweBQ0bT/19PCeygOqnST7R+bn0ALzMHkIrNknZ
 4c2YxF8KzeLLujFhZIYae5Wl5gsNBtocPM/X6xOgwZqYtx/ItwulsakHu5iGcLiOtB6ssYxwiUu
 3cUQiuZ3olYkT4P2WDqPipJitCknK2pVFhz2iDGeyenMf+psaFIZ2/z3yN/7HBHN5NDADeYg43h
 +xUtGIZk0QZ2Tt2bb4y962ClxjruQ=
X-Received: by 2002:a05:6830:3986:b0:7d9:d530:f1e8 with SMTP id
 46e09a7af769-7dbb72d3da2mr12542349a34.26.1775603286071; 
 Tue, 07 Apr 2026 16:08:06 -0700 (PDT)
Received: from envy.hsd1.co.comcast.net ([2601:282:1d00:ad10::7451])
 by smtp.gmail.com with ESMTPSA id
 46e09a7af769-7dbc54ba910sm9100178a34.14.2026.04.07.16.08.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 07 Apr 2026 16:08:05 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: 80689 <at> debbugs.gnu.org
Subject: [PATCH v3 1/2] add optional SENTINEL argument to shell-command
Date: Tue,  7 Apr 2026 17:08:01 -0600
Message-ID: <6fb46e1d680841357a8cdc6820b5dec61cb11d1e.1775602725.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <875x649wjt.fsf@HIDDEN>
References: <875x649wjt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80689
Cc: "S.C. Morris" <scmorris.dev@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

From: "S.C. Morris" <scmorris.dev@HIDDEN>

* lisp/simple.el (shell-command, async-shell-command): Add optional
SENTINEL argument, passed to `set-process-sentinel' for asynchronous
commands instead of `shell-command-sentinel'.

* lisp/net/tramp.el (tramp-handle-shell-command): Likewise.

* etc/NEWS: Document new SENTINEL argument.
---
 etc/NEWS          |  6 ++++++
 lisp/net/tramp.el |  4 ++--
 lisp/simple.el    | 14 +++++++++-----
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 0bdd2c9b84d..5c4f9e10f03 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4325,6 +4325,12 @@ buffer.  The buffer name is derived from the command string, using
 'shell-command-buffer-name' or 'shell-command-buffer-name-async' as
 a prefix.
 
++++
+** 'shell-command' and 'async-shell-command' accept a new optional SENTINEL arg.
+When non-nil, it is used as the process sentinel for the asynchronous
+command instead of 'shell-command-sentinel', allowing callers to
+handle process completion events in a custom way.
+
 +++
 ** 'shell-command-buffer-name' and 'shell-command-buffer-name-async' accept functions.
 These variables may now be set to a function called with the command
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index ad4ddd50477..7aed8c55118 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5636,7 +5636,7 @@ tramp-handle-process-attributes
       (when (= (cdr (assq 'pid elt)) pid)
         (throw 'result elt)))))
 
-(defun tramp-handle-shell-command (command &optional output-buffer error-buffer)
+(defun tramp-handle-shell-command (command &optional output-buffer error-buffer sentinel)
   "Like `shell-command' for Tramp files."
   (let* ((asynchronous (string-match-p (rx (* blank) "&" (* blank) eos) command))
 	 (command (substring command 0 asynchronous))
@@ -5750,7 +5750,7 @@ tramp-handle-shell-command
                  ((not (eq major-mode 'shell-mode))
                   (shell-mode)))
 		(set-process-filter p #'comint-output-filter)
-		(set-process-sentinel p #'shell-command-sentinel)
+		(set-process-sentinel p (or sentinel #'shell-command-sentinel))
 		(when error-file
 		  (add-function
 		   :after (process-sentinel p)
diff --git a/lisp/simple.el b/lisp/simple.el
index d4eaef9ea67..b917d081831 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4538,7 +4538,7 @@ shell-command-set-point-after-cmd
 ;; the same signature as 'shell-command', although the 3rd arg is
 ;; currently ignored, to allow us to implement support for specifying
 ;; ERROR-BUFFER in the future.
-(defun async-shell-command (command &optional output-buffer error-buffer)
+(defun async-shell-command (command &optional output-buffer error-buffer sentinel)
   "Execute string COMMAND asynchronously in background.
 
 Like `shell-command', but adds `&' at the end of COMMAND
@@ -4588,7 +4588,7 @@ async-shell-command
     shell-command-default-error-buffer))
   (unless (string-match "&[ \t]*\\'" command)
     (setq command (concat command " &")))
-  (shell-command command output-buffer error-buffer))
+  (shell-command command output-buffer error-buffer sentinel))
 
 (declare-function comint-output-filter "comint" (process string))
 (declare-function comint-term-environment "comint" ())
@@ -4596,7 +4596,7 @@ async-shell-command
 (defvar async-shell-command-mode 'shell-command-mode
   "Major mode to use for the output of asynchronous `shell-command'.")
 
-(defun shell-command (command &optional output-buffer error-buffer)
+(defun shell-command (command &optional output-buffer error-buffer sentinel)
   "Execute string COMMAND in inferior shell; display output, if any.
 With prefix argument, insert the COMMAND's output at point.
 
@@ -4664,6 +4664,10 @@ shell-command
 In an interactive call, the variable `shell-command-default-error-buffer'
 specifies the value of ERROR-BUFFER.
 
+If the optional fourth argument SENTINEL is non-nil, it is used as the
+process sentinel for an asynchronous command instead of the default
+`shell-command-sentinel'.
+
 In Elisp, you will often be better served by calling `call-process' or
 `start-process' directly, since they offer more control and do not
 impose the use of a shell (with its need to quote arguments)."
@@ -4689,7 +4693,7 @@ shell-command
 	 (find-file-name-handler (directory-file-name default-directory)
 				 'shell-command)))
     (if handler
-	(funcall handler 'shell-command command output-buffer error-buffer)
+	(funcall handler 'shell-command command output-buffer error-buffer sentinel)
       (if (and output-buffer
                (not (string-match "[ \t]*&[ \t]*\\'" command))
                (or (eq output-buffer (current-buffer))
@@ -4810,7 +4814,7 @@ shell-command
                 (setq-local revert-buffer-function
                             (lambda (&rest _)
                               (async-shell-command command buffer)))
-                (set-process-sentinel proc #'shell-command-sentinel)
+                (set-process-sentinel proc (or sentinel #'shell-command-sentinel))
 		;; Use the comint filter for proper handling of
 		;; carriage motion (see comint-inhibit-carriage-motion).
                 (set-process-filter proc #'comint-output-filter)
-- 
2.52.0





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 7 Apr 2026 23:08:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 19:08:09 2026
Received: from localhost ([127.0.0.1]:43691 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAFWj-0008Fp-8p
	for submit <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:08:09 -0400
Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:48470)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <scmorris.dev@HIDDEN>)
 id 1wAFWg-0008FN-Dg
 for 80689 <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:08:06 -0400
Received: by mail-ot1-x334.google.com with SMTP id
 46e09a7af769-7d7f92bde91so3457829a34.1
 for <80689 <at> debbugs.gnu.org>; Tue, 07 Apr 2026 16:08:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1775603285; x=1776208085; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=/trkwrJqh2G8d3rts7yCGaAe7qGzvBJpJssutvFOoZM=;
 b=jNzXj/Fw1fCSTM09y7Rb7gseMY48RuA81H67vQGbIcc7NfjNvuxIsIHLSMgh6Js3Nb
 OXLcJeD0xo366lTOP9NvfnVsxISb1dKPoe781iMCmH+rl1WK5X0dRkHPyhRU+9RkJaFJ
 cxFzqs6BLY1HFxIkUlYaZlgTvSUfHlLj1Q35iOdHLX53tWwLxewPDAROvOKeplTRu3oH
 bHoyIot9g4CgTl2TIQttJWNLS9XcilagAqKiISDHNmiRvaU4AFEtgoSo22HcMAhGtEfT
 HAvkocKrGj4jG2zTIaetO5qjT5ND26nzvb6+26FO5lKu1r9p21UcNTuBGfu99jnRtsaW
 LMoQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1775603285; x=1776208085;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=/trkwrJqh2G8d3rts7yCGaAe7qGzvBJpJssutvFOoZM=;
 b=aNBfF5kr7ToJpV2bL5H+687sa2PK5CgUXtJtTLhmEE2eQ/HQiMRSO4TJl0koVt7zVY
 DOIA3h3zbg3pgyV9a/lfg2LcdfKKbTTYprfIE2/o5uzDHnrQLBLexcZWYK+Wdv/psgWj
 VpaVnBxlv54IKlfTkd/RFXgoCf2TlWmzmdkEEmov8OeYm+w4x5hi6qem7EzbWLYSYDxk
 ikcbYFi58cKr5fF31XzezOgemRNssNKXric4IOsWJBH/RkqKOCCw5B/R4HZHcdMQQRac
 0/tGTy8GmTnGnwMve2arBpi+pWOCqMkj6rqUAhGY+5BFAuath8GUbmEhQmlq3oteMmSb
 kX8A==
X-Gm-Message-State: AOJu0YxdY8aD7nh9WQl2pwoXJD482gjGkGa2i4XyvfGSOfb6WauTTjvj
 4AL9bqjYq9K/RTKr+3pWHAOVHh3kiwnCpFG5ZJrF9FV6WjlqqjC7Z66C5xg5wK7/OFw=
X-Gm-Gg: AeBDievo+r1VAZwDdSRlqAOvSh1hNV3idLzmLG6hy6BIB7XdWlQE2NWxfrujDo27IGI
 3RaGr2D2wRYHObaTmjo4vhbBVyUgHpRGWAwtZY11dzhKX0HgE8HncX3vO+OCtABTKROG2r1sU65
 E4tztVdEO5Qb3Zo/pr1XRg5ZPExBVXESI6Bbokxoh2VUT3fdUnn4Jy0dNcC6SUqccwdzAPw0wSJ
 ejXFEKiZzuONguEYL+NVCXmP05BzNhabizDkjgUVGJpaweKakte6mjGC9rvXD8MPFuqC8OPnar5
 fkKfFakgdzAhcFGBJ5mwUp+1Oh4deMnL8tniy870SQeQwMnrBbRFNH306J1P/lVhbf7wVC/Qh7s
 FgEV/NVy9w9S3UUQkb4hkzceScQZSSK8ZQS5ohNVaG1O4V9lBnkyVlutD6BjxklZWn//AX4JG9k
 QXmijcHRfKw261e7Q5c7DR9zQTmD4=
X-Received: by 2002:a05:6830:2546:b0:7d7:f59f:3d1f with SMTP id
 46e09a7af769-7dbb6ee6e6bmr12564233a34.6.1775603285035; 
 Tue, 07 Apr 2026 16:08:05 -0700 (PDT)
Received: from envy.hsd1.co.comcast.net ([2601:282:1d00:ad10::7451])
 by smtp.gmail.com with ESMTPSA id
 46e09a7af769-7dbc54ba910sm9100178a34.14.2026.04.07.16.08.04
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 07 Apr 2026 16:08:04 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: 80689 <at> debbugs.gnu.org
Subject: [PATCH v3 0/2] improve shell-command async process handling
Date: Tue,  7 Apr 2026 17:08:00 -0600
Message-ID: <cover.1775602725.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <875x649wjt.fsf@HIDDEN>
References: <875x649wjt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80689
Cc: "S.C. Morris" <scmorris.dev@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

From: "S.C. Morris" <scmorris.dev@HIDDEN>

This series improves how callers interact with shell-command's async process.

Patch 1 replaces the earlier shell-command-sentinel-function variable with a
new optional SENTINEL argument to shell-command and async-shell-command.  When
non-nil, it is passed directly to set-process-sentinel instead of the default
shell-command-sentinel.  An optional argument is more discoverable and avoids
introducing a new global variable.

Patch 2 makes shell-command return the process object when the command is run
asynchronously.  Previously it returned the result of display-buffer (a window),
which was undocumented and not useful.  The window and output buffer remain
accessible via get-buffer-window and process-buffer.

S.C. Morris (2):
  add optional SENTINEL argument to shell-command
  make shell-command return the process for async commands

 etc/NEWS          | 13 +++++++++++++
 lisp/net/tramp.el |  4 ++--
 lisp/simple.el    | 17 +++++++++++------
 3 files changed, 26 insertions(+), 8 deletions(-)

-- 
2.52.0





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 6 Apr 2026 11:07:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 06 07:07:52 2026
Received: from localhost ([127.0.0.1]:45716 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w9ho6-000093-6t
	for submit <at> debbugs.gnu.org; Mon, 06 Apr 2026 07:07:51 -0400
Received: from flow-a3-smtp.messagingengine.com ([103.168.172.138]:42787)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>)
 id 1w9hnz-00007C-04
 for 80689 <at> debbugs.gnu.org; Mon, 06 Apr 2026 07:07:46 -0400
Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49])
 by mailflow.phl.internal (Postfix) with ESMTP id 9C9E6138057D;
 Mon,  6 Apr 2026 07:07:37 -0400 (EDT)
Received: from phl-frontend-04 ([10.202.2.163])
 by phl-compute-09.internal (MEProxy); Mon, 06 Apr 2026 07:07:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name;
 h=cc:cc:content-type:content-type:date:date:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:subject:subject:to:to; s=fm1; t=1775473657; x=
 1775477257; bh=J6vLhkgMdEFO3zITRmxrJzHeSEzfMfOgJBxwJgtYfNo=; b=W
 3GKHeUb/DK4eQyHHjHK+dRbmVdPTEndvQaLP5P/EmC0TgGe5hfsX2jq0O8NGds7x
 LJetbE20KSh+MJRQvaD0gn2rdqPMuXDoX9Ge9zqod7NHHANLpTgqsYpWtEKhTJBq
 BviuY0Mm1vgpbITFtWwmleEAZtpPVsI/8l9Z0ihFIBH9k95WPOgRQtcs/Btn5D/w
 Eso6GNDsmEEXpYqvxmbJSz8RWnMcMDmak4ydhIPzu1VruhSVajKWmJeJp3KYfEhf
 79y6W8eUTxY906Xb7ZhXRfDDtlNZL16q4Nit24Y/yyUJmJ3yq1ObbARVXXeeVR1O
 VQ6P9HiRVVLiFBqVaIYHg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=
 1775473657; x=1775477257; bh=J6vLhkgMdEFO3zITRmxrJzHeSEzfMfOgJBx
 wJgtYfNo=; b=Ojhuz5xd6YVT5yYF6ko91oUnyxLKA7cf41COEVr3aHF2ud37bsX
 MkvZA2XmlrRbJ6LreAFrCmOkIT8I0YCpHFeH/0MLgvmQ2ZEtYJDXrGUagWrbKfUj
 EJAlxyy+z8xrUb0lvpQVvPhcwY7xNlVKwntuABXHDW833y+zXGFgumu8ecKw/PUQ
 xuPh/ROEwdi6jHWWsNhtlz2kHxUmtC9hRdKfgC6vEH2WGGH7PJjT15wLNZNG4tiu
 8yIfSE1KmNxQUXcqb+Mup/HU0ccSsGaM2IuZf8Ur2vw7pcGan+ct679nHVXpnsZR
 iuWLVqHNogs4RvAYK0T+yck5qGvtABUiwPw==
X-ME-Sender: <xms:-ZPTaQF64HMM5yWO4wUUrcArH5AB2mSTTWSoJubYeOp-ftaObGVjyw>
 <xme:-ZPTaXLmPDQRcHtXKziI6oYk9KG-SB4oNVCNBOVhp2Uh-jUOoZorUqoLWT2aqgdH8
 ld065hXSJIOD1bNHlKhXwoSWHjAocXkZYcIj-nXfsbx841cERzmHb8>
X-ME-Received: <xmr:-ZPTaUnAUe9w4dgk7ECX_vnfjk5-Oln-OcOhBfSkRBNpEnXJ2SvzaQa_lFoiQauMLSHw0J5zn_Bac2UQHHS_D4DIaOvAyg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddujeehhecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
 ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug
 hrpefhvfevufgjfhffkfggtgesthdttddttddttdenucfhrhhomhepufgvrghnucghhhhi
 thhtohhnuceoshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvqeenucggtf
 frrghtthgvrhhnpedvvdehgefghfeuhfelkeduffehgfehkeefteekfffgffdvueefuefg
 udffhfduhfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh
 hmpehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgdpnhgspghrtghpthht
 ohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepkedtieekleesuggvsggsuh
 hgshdrghhnuhdrohhrghdprhgtphhtthhopehstghmohhrrhhishdruggvvhesghhmrghi
 lhdrtghomhdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphhtthhopehmoh
 hnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-ME-Proxy: <xmx:-ZPTafTCcjjAW5pSl5D_39mCFIyafS7zym7tWjZZu22OHPOvGIflXg>
 <xmx:-ZPTaWJN3_y2IELEklvgY-waWbvmKToh0kRUJRTLDOb63JSDbMoGqw>
 <xmx:-ZPTaVDlHrgTR__4APAnpYvOV-7OOp8K2CqOGVWyruBz5iO3EcS1Ow>
 <xmx:-ZPTafAVAJDJuWIWpgZCQ0mjpN2xC_AosSxv9-nQ_GUsNG3yKAzLBg>
 <xmx:-ZPTaRWwcANQ3MFOmVyr7sJ7d49u9gF_sPIlhhJ97Qfz7i8SMEzqxCXU>
Feedback-ID: i62564b17:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 6 Apr 2026 07:07:37 -0400 (EDT)
Received: by zephyr.silentflame.com (Postfix, from userid 1000)
 id 191A39402EE; Mon, 06 Apr 2026 12:07:34 +0100 (BST)
From: Sean Whitton <spwhitton@HIDDEN>
To: Samuel Morris <scmorris.dev@HIDDEN>
Subject: Re: bug#80689: [PATCH 2/2] add shell-command-finished-hook
In-Reply-To: <CAEkeNzid4KTfkjf7-+C8jUdrFoMY2PCRDc8WH=0HsnKou2T7-w@HIDDEN>
References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
 <ef6669abce4d126d4c55dcdba0246558c826c13d.1774821272.git.scmorris.dev@HIDDEN>
 <865x6dqp9z.fsf@HIDDEN>
 <CAEkeNzhzd=szHKx5waOsXw8EE0pp8JQR6EoWhHo-v0DvvGYWtA@HIDDEN>
 <86fr5foo7m.fsf@HIDDEN> <87mrzhg494.fsf@HIDDEN>
 <CAEkeNzid4KTfkjf7-+C8jUdrFoMY2PCRDc8WH=0HsnKou2T7-w@HIDDEN>
Date: Mon, 06 Apr 2026 12:07:34 +0100
Message-ID: <875x649wjt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Samuel Morris [05/Apr 10:07pm -06] wrote:
> Yes I could certainly do that, though it would change the interface to
> shell-command. Currently, looks like it is returning the window object
> for async processes. This is undocumented though, and so I think it's
> a valid change. But I could see some people relying on that. The
> process object is more useful though imo because you can get the
> window object from that easily. I can put that into a separate commit
> here in my next version.

In Lisp, there are often random return values that the author didn't
think carefully about.  So if it's not documented as returning a
particular value then generally it's okay to change.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 6 Apr 2026 04:07:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 06 00:07:30 2026
Received: from localhost ([127.0.0.1]:40957 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w9bFI-0000Mh-9D
	for submit <at> debbugs.gnu.org; Mon, 06 Apr 2026 00:07:29 -0400
Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:60427)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <scmorris.dev@HIDDEN>)
 id 1w9bFF-0000Ly-3M
 for 80689 <at> debbugs.gnu.org; Mon, 06 Apr 2026 00:07:26 -0400
Received: by mail-ed1-x534.google.com with SMTP id
 4fb4d7f45d1cf-66f1ef0e1a8so227567a12.0
 for <80689 <at> debbugs.gnu.org>; Sun, 05 Apr 2026 21:07:25 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1775448443; cv=none;
 d=google.com; s=arc-20240605;
 b=cJBOdztoGAoBWhoYc4l6GjtMryAIKUPNiQzeMEjbsIV1XANFAm9/tf7eF3SQJVBWLC
 zIDH4MWY6jF5Zete+zpJb4v8nWBzHQDbfify5jHzUb60I0b6Em2EaNJQw8DfNimcx/DJ
 P4c5JmbfmbB7i7zsuYdI8RZerY2p4T11g2Tx8PWdn/4E+uCDlU60R8JWTw0fWNtFalCW
 mkBBEiobuxEX0jxwafWSLlWfIBq2xGxut2YPQWKfQiT5BUM72YelSxN1onz5c/Bh3wGK
 8J2Dr7kO+FaM/L1vOCVzHKxabdsbpjWWklJmWJQ9pIxKcnu3GL10IYiIxxylNgljUqO2
 H0Zg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20240605; 
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:dkim-signature;
 bh=fx5NCBr9rMjITsM2ymm987GYYAMhBRAXRpGK1Tm9eSQ=;
 fh=3YmjqnzoAqA8mFtxePrZsgc6gOA9/+Av2s3IjRPHvso=;
 b=bIS3eDBgvkIYSOJhfy1F949mWhGB+wlg9nxDdC6VIkqgDg29/qfgpzo7/a1XRo8Rd4
 WwDFOMycnEOadQLzGGOVnmT1szp2+1rFCGc3Fj20I6jECeeGkua/xgJ9MHNfyvjsGssc
 EAXVkn2VHzDnEvmAceGF4HttFHiWCPXkShs7OKfoGD+XuD3w9IlNB6Iw+TnHBoCjngfH
 s0jkA2Ah+ULjUzP2rFvbAt7kE0XSoKmsrClbJIlvFJw7/0yqitiTCUtmxgaJVWNTTzaL
 rp8SiYQ5GyKBFniGe9I5McsiYwe/q1KEjYeaBCd6g2cPJUT4zdevNQY/7aYuMUG4OfAx
 GjJQ==; darn=debbugs.gnu.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1775448443; x=1776053243; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=fx5NCBr9rMjITsM2ymm987GYYAMhBRAXRpGK1Tm9eSQ=;
 b=SpUsYRy3LQwzglJh63VvqgEtfFefSigXwY4sMzpGXqr/Nq+FCabce+xRFQHSz0bAbF
 ubTjAmMuRSkB/tq59KsyTWoGYnGrV+JOX+s939keSjPWhTAsr8ugnIcfW8cybpwtResM
 4GCotJBGwKpUWwylVAUnpjx5c+5zgacoPe8cx81HImPcLyxTxDVELsA9tzY2QHYq5/Ve
 uS+RApVDAb0BZFxN/WwTpfMrR91fw7GoGEUmiuB6/QKOPy8HjjhxkXw1DugDLCDzKRHp
 XKZzBiMkGUwcXOrDybZ8v4hzOMewV+yH26w3ZT7sMqTEMeZPq8k5ubiDa9Asjc5iRDoA
 GwCg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1775448443; x=1776053243;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=fx5NCBr9rMjITsM2ymm987GYYAMhBRAXRpGK1Tm9eSQ=;
 b=GOBkyeuK+I1tNXfBm/Rt+q8rcXHJ/4YWdRrNAM+PGkv0dYVrGQoQW/5ytHBQrqxSzy
 Hj0H+XRVai1Lu7QGOQazWoM2VR2NtjGSgg9iVhvyyh16P56YQXvCCkOZ/pPpG5HXDG03
 xB1i/VEJe95MHkhLI+6wCYNop4yuiXdRhDXtbx6VXe9diZSem2Ow7asGCkMGKS9oA9RG
 RuhzsuqysFZqL+g8egWjUUmjmOkf7A46M0RZ8ZyC52p0WiwX2dLnak6aFyu44ut1CyXZ
 BzMwsbYwRPrt7TKUuG21CC5oHrfnaDzZzxPgOWa7JR9H9PeqOEpl/IbeRJSJxhZ/DFdQ
 5K/w==
X-Forwarded-Encrypted: i=1;
 AJvYcCV96JXXxlDaPGHYWsJG9frGVqYNM506gAzgqG6zM+ALfia+gsAQquEukpauQUYFfxtJ03yciQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yw1OSEqfQ7XpEfibIamxqIRFZUfiT89MtHUc+W+ngyyc/t1RcYq
 VyXmKekrw901ncEYLMIXZroWoCdwpcFfRcIkTCFPJ8tm3TLHTjIOQ++ECReB8xlFBNifiPqkwwu
 3alC7nlPEhEuJuE/aNNK/lU7O0IGXTvw=
X-Gm-Gg: AeBDiesdxf1vzJ5EW3RMiKBIkXZkkiq4PkB6JksVcVTcieN0DrAADTVbMr5JhcOkEED
 7NYN7D9olWcvG90OXa71VfyHymVh5fzROv4ItbepBiHmCSDke7g3y6PGN3HZmWvUZTYB1jJdd64
 GA1VzvXz4FipkedDFgvg0PCH6YAmUY0HbZI+yMjUG3OvhL1BFLB3QaTAwJ+dDHmJDUb3o+gkRJj
 aLRBxtkURWpPsJlM9TWjx7nzt6fjEkKclXdDYzig5Ns0jwMC0xbrnFWJbU8CWOHzqXzMA6gaPfN
 VPNurmbUSJPvXku8K7ij0A==
X-Received: by 2002:a17:907:93c4:b0:b9b:3a4f:ee86 with SMTP id
 a640c23a62f3a-b9c67b459c7mr386422166b.26.1775448442647; Sun, 05 Apr 2026
 21:07:22 -0700 (PDT)
MIME-Version: 1.0
References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
 <ef6669abce4d126d4c55dcdba0246558c826c13d.1774821272.git.scmorris.dev@HIDDEN>
 <865x6dqp9z.fsf@HIDDEN>
 <CAEkeNzhzd=szHKx5waOsXw8EE0pp8JQR6EoWhHo-v0DvvGYWtA@HIDDEN>
 <86fr5foo7m.fsf@HIDDEN> <87mrzhg494.fsf@HIDDEN>
In-Reply-To: <87mrzhg494.fsf@HIDDEN>
From: Samuel Morris <scmorris.dev@HIDDEN>
Date: Sun, 5 Apr 2026 22:07:11 -0600
X-Gm-Features: AQROBzB9fv1zWRtE-2QHcCApCAyo--58q-32pslJZIPeRWGGYGxMq4AxZJ7IY2U
Message-ID: <CAEkeNzid4KTfkjf7-+C8jUdrFoMY2PCRDc8WH=0HsnKou2T7-w@HIDDEN>
Subject: Re: bug#80689: [PATCH 2/2] add shell-command-finished-hook
To: Sean Whitton <spwhitton@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000bdb931064ec2cd47"
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--000000000000bdb931064ec2cd47
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sun, Apr 5, 2026 at 3:12=E2=80=AFAM Sean Whitton <spwhitton@HIDDEN=
me>
wrote:

> Eli Zaretskii <eliz@HIDDEN> [31/Mar  9:20pm +03] wrote:
> >> From: Samuel Morris <scmorris.dev@HIDDEN>
> >> Date: Tue, 31 Mar 2026 11:16:22 -0600
> >> Cc: 80689 <at> debbugs.gnu.org
> >>
> >>  > This hook is run by 'shell-command-sentinel' when an asynchronous
> shell
> >>  > command process exits or is signalled.  Each function is called wit=
h
> two
> >>  > arguments: PROCESS and SIGNAL.
> >>
> >>  Thanks, but could you please describe the rationale and perhaps
> >>  describe a couple of use cases where such a hook could needed?
> >>
> >> Yes, of course. For my immediate use-case, I have emacs trigger a
> >> desktop notification when an asynchronous process completes, and
> >> display the buffer in a configurable way, in particular, resetting
> >> POINT to the beginning of the buffer, and setting the buffer to text
> >> mode when the inferior process dies so I=E2=80=99m not trying to signa=
l a dead
> >> process.
> >>
> >> But I was really not thinking this through carefully enough. What if I
> >> want to process more than just the sighup signal, or override more
> >> behavior in shell-command-sentinel, or do things differently per async
> >> shell buffer? What I really want is a customizable sentinel, while
> >> still avoiding rewriting all of shell-command to point to my
> >> version. So something like this in shell-command:
> >>
> >> ;; before
> >> (set-process-sentinel proc #'shell-command-sentinel)
> >> ;; after
> >> (set-process-sentinel proc shell-command-sentinel-function)
> >>
> >> Where shell-command-sentinel-function points to shell-command-sentinel
> >> by default. That way I can start adding full, programmatic two-way
> >> communication between emacs and the subprocess. If it is okay with
> >> you, I would like to resubmit with that change. What are your
> >> thoughts? And thank you very much for taking the time to look at this.
> >
> > I'm beginning to think that shell-command is not the right tool for
> > such flexible jobs.  Isn't it easier to just write your own command,
> > and then do all of that in the sentinel that you write?
> >
> > But I guess we could also let users and Lisp programs customize the
> > sentinel of shell-command.  Sean and Stefan, WDYT?
>
> Instead of a variable to let-bind around calls to shell-command, we
> could also add a new optional argument to shell-command.  Samuel, what
> do you think of that?
>

Yes, that would work for me as well, I have no need to globally change the
default sentinel. Making it a parameter seems more natural and more easily
discoverable. That makes sense to me.


>
> I agree with Stefan about making shell-command return the process
> object.
>

Yes I could certainly do that, though it would change the interface to
shell-command. Currently, looks like it is returning the window object
for async processes. This is undocumented though, and so I think it's
a valid change. But I could see some people relying on that. The
process object is more useful though imo because you can get the
window object from that easily. I can put that into a separate commit
here in my next version.


>
> --
> Sean Whitton
>

--000000000000bdb931064ec2cd47
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Sun, Apr 5, 2026 at 3:12=E2=80=AFAM Se=
an Whitton &lt;<a href=3D"mailto:spwhitton@HIDDEN">spwhitton@spwhit=
ton.name</a>&gt; wrote:</div><div class=3D"gmail_quote gmail_quote_containe=
r"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord=
er-left:1px solid rgb(204,204,204);padding-left:1ex">Eli Zaretskii &lt;<a h=
ref=3D"mailto:eliz@HIDDEN" target=3D"_blank">eliz@HIDDEN</a>&gt; [31/Mar=
=C2=A0 9:20pm +03] wrote:<br>
&gt;&gt; From: Samuel Morris &lt;<a href=3D"mailto:scmorris.dev@HIDDEN" =
target=3D"_blank">scmorris.dev@HIDDEN</a>&gt;<br>
&gt;&gt; Date: Tue, 31 Mar 2026 11:16:22 -0600<br>
&gt;&gt; Cc: <a href=3D"mailto:80689 <at> debbugs.gnu.org" target=3D"_blank">806=
89 <at> debbugs.gnu.org</a><br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 &gt; This hook is run by &#39;shell-command-sentinel&#39; wh=
en an asynchronous shell<br>
&gt;&gt;=C2=A0 &gt; command process exits or is signalled.=C2=A0 Each funct=
ion is called with two<br>
&gt;&gt;=C2=A0 &gt; arguments: PROCESS and SIGNAL.<br>
&gt;&gt;<br>
&gt;&gt;=C2=A0 Thanks, but could you please describe the rationale and perh=
aps<br>
&gt;&gt;=C2=A0 describe a couple of use cases where such a hook could neede=
d?<br>
&gt;&gt;<br>
&gt;&gt; Yes, of course. For my immediate use-case, I have emacs trigger a<=
br>
&gt;&gt; desktop notification when an asynchronous process completes, and<b=
r>
&gt;&gt; display the buffer in a configurable way, in particular, resetting=
<br>
&gt;&gt; POINT to the beginning of the buffer, and setting the buffer to te=
xt<br>
&gt;&gt; mode when the inferior process dies so I=E2=80=99m not trying to s=
ignal a dead<br>
&gt;&gt; process.<br>
&gt;&gt;<br>
&gt;&gt; But I was really not thinking this through carefully enough. What =
if I<br>
&gt;&gt; want to process more than just the sighup signal, or override more=
<br>
&gt;&gt; behavior in shell-command-sentinel, or do things differently per a=
sync<br>
&gt;&gt; shell buffer? What I really want is a customizable sentinel, while=
<br>
&gt;&gt; still avoiding rewriting all of shell-command to point to my<br>
&gt;&gt; version. So something like this in shell-command:<br>
&gt;&gt;<br>
&gt;&gt; ;; before<br>
&gt;&gt; (set-process-sentinel proc #&#39;shell-command-sentinel)<br>
&gt;&gt; ;; after<br>
&gt;&gt; (set-process-sentinel proc shell-command-sentinel-function)<br>
&gt;&gt;<br>
&gt;&gt; Where shell-command-sentinel-function points to shell-command-sent=
inel<br>
&gt;&gt; by default. That way I can start adding full, programmatic two-way=
<br>
&gt;&gt; communication between emacs and the subprocess. If it is okay with=
<br>
&gt;&gt; you, I would like to resubmit with that change. What are your<br>
&gt;&gt; thoughts? And thank you very much for taking the time to look at t=
his.<br>
&gt;<br>
&gt; I&#39;m beginning to think that shell-command is not the right tool fo=
r<br>
&gt; such flexible jobs.=C2=A0 Isn&#39;t it easier to just write your own c=
ommand,<br>
&gt; and then do all of that in the sentinel that you write?<br>
&gt;<br>
&gt; But I guess we could also let users and Lisp programs customize the<br=
>
&gt; sentinel of shell-command.=C2=A0 Sean and Stefan, WDYT?<br>
<br>
Instead of a variable to let-bind around calls to shell-command, we<br>
could also add a new optional argument to shell-command.=C2=A0 Samuel, what=
<br>
do you think of that?<br></blockquote><div>=C2=A0</div><div>Yes, that would=
 work for me as well, I have no need to globally change the<br>default sent=
inel. Making it a parameter seems more natural and more easily<br>discovera=
ble. That makes sense to me.<br>=C2=A0</div><blockquote class=3D"gmail_quot=
e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)=
;padding-left:1ex">
<br>
I agree with Stefan about making shell-command return the process<br>
object.<br></blockquote><div><div><br></div><div>Yes I could certainly do t=
hat, though it would change the interface to<br>shell-command. Currently, l=
ooks like it is returning the window object<br>for async processes. This is=
 undocumented though, and so I think it&#39;s<br>a valid change. But I coul=
d see some people relying on that. The<br>process object is more useful tho=
ugh imo because you can get the<br>window object from that easily. I can pu=
t that into a separate commit=C2=A0</div><div>here in my next version.</div=
>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
-- <br>
Sean Whitton<br></blockquote></div></div>

--000000000000bdb931064ec2cd47--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 5 Apr 2026 09:12:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 05 05:12:35 2026
Received: from localhost ([127.0.0.1]:55822 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w9JX0-00081p-KS
	for submit <at> debbugs.gnu.org; Sun, 05 Apr 2026 05:12:35 -0400
Received: from flow-b3-smtp.messagingengine.com ([202.12.124.138]:39009)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>)
 id 1w9JWy-00081O-2E
 for 80689 <at> debbugs.gnu.org; Sun, 05 Apr 2026 05:12:32 -0400
Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41])
 by mailflow.stl.internal (Postfix) with ESMTP id 8B4C31300024;
 Sun,  5 Apr 2026 05:12:26 -0400 (EDT)
Received: from phl-frontend-03 ([10.202.2.162])
 by phl-compute-01.internal (MEProxy); Sun, 05 Apr 2026 05:12:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name;
 h=cc:cc:content-transfer-encoding:content-type:content-type
 :date:date:from:from:in-reply-to:in-reply-to:message-id
 :mime-version:references:reply-to:subject:subject:to:to; s=fm1;
 t=1775380346; x=1775383946; bh=IQimzDRBz+I3jba+huNgHqlsweHeQ/Zj
 jfWrhz5EFKc=; b=dCop2vD16CyILVrCcB/3Y5ay8BivRPnW2tvhItHBqH1gYtsS
 OUfFTze1neqdZotv92zhR84s2TLoXcbkjcbTCr6ZF1Q61KSDjZlpAEcIHzD+CbNd
 22zcQM7bJMpmn3FQQztZLOIQWbkBDtRbHKpeaQG5FAiHTAYSrMYAFQR3lv1xK/fo
 6hImaH4plNrGRfG0QAKgOtWp8OPlRCjob4WOxRBNa/f8EF5KELcWf5dCxkg6EjVZ
 kYMp47SrkQQaM+sAJl8unhv49+DKewC7hiHXnw/iesr+KlM7/aHH5+LLJyReZOLt
 OMh3CkLDIDoHRmRYyyZ9V1xw5JDoRucIP79aow==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1775380346; x=
 1775383946; bh=IQimzDRBz+I3jba+huNgHqlsweHeQ/ZjjfWrhz5EFKc=; b=T
 L5bDt7bvh2HA3bOz9M2T9RD4S3+3Wh7IoGBC5f3t7aBxoRMHOKPpcapvKi5rjSO0
 wvSzUx9RoajCPzFKVmQbmXH0nJgU0w9uDl/arBYPZx3qfflmb5hFvcXeYoMW0R8R
 OlJ0EVc9OX71huxWa+PcQEclagVbDEqsRrX5xDowHRZg3jZS/Ip1ye53C3yrV+Hj
 gdtkI2vhIlk+ruyMiGpRAGCoOYURK4UMY6kFiJ/Me2JrwCc0NdgfBqx3YXaOj+aq
 xa8s7rgQJeV3Nf3yq3o5Fo4pfVCumhugbW4on7oK8pzvxqrmp27+o/z34CcWNumR
 z2rHaVwAaCf9sqzhTtdrQ==
X-ME-Sender: <xms:eSfSaYqWxTP0IoR-Faqc0agjf6Km4tF5F7Hl-cqgqoTa4fkwJLoT4Q>
 <xme:eSfSacciudy3gReUYVsrjvbytdXldrAjZ3Z0BhZaHryCuLCBLBEHdNP7dvUrLeeae
 FiM98w3nkkJHNcJ0NpzreFRdUR5s4BFbnSAnmggl_l1MpT1sa-kZpY>
X-ME-Received: <xmr:eSfSaXrOx57iy02HHriW45Uz3GtxDTVUUSyEmQ64Pqt12ttMnZE8Bwl8bFM1ra-WTXx_5YE_COKgSLXE07nHy79EFFyD1g>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddugeefiecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
 ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug
 hrpefhvfevufgjfhffkfggtgfgsehtqhdttddttdejnecuhfhrohhmpefuvggrnhcuhghh
 ihhtthhonhcuoehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgeqnecugg
 ftrfgrthhtvghrnhepueeileetkeeljeeiteekkeefuedutddvjefgkedvgeekveehhefg
 geetffeftdeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh
 homhepshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvpdhnsggprhgtphht
 thhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeektdeikeelseguvggssg
 hughhsrdhgnhhurdhorhhgpdhrtghpthhtohepshgtmhhorhhrihhsrdguvghvsehgmhgr
 ihhlrdgtohhmpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepmh
 honhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggr
X-ME-Proxy: <xmx:eSfSadHTopGsJRo1w9Wip9TVCWmWvNaAGgQ6VBSgst2NjfvpCYys3g>
 <xmx:eSfSaXsJOVeuP_NgdXByRtuAdg4zIp4xG3QF-2s5JWDGAmYgJdmueg>
 <xmx:eSfSafVxXuS2pgrwxn1xQJKyLnfF3hkNJF7XMcWNhdMYvyTmzClNmw>
 <xmx:eSfSaTE2hz2NJOP-11TYhrh7Yt2UwXdan52EOj2L_qNOIvFAJ6gS6A>
 <xmx:eifSafzsHVHsbiBeTQNgm8SB5KML7j7vXmkP_EjXek3AXlk15pvT8vtm>
Feedback-ID: i62564b17:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun,
 5 Apr 2026 05:12:25 -0400 (EDT)
Received: by zephyr.silentflame.com (Postfix, from userid 1000)
 id 3E0E494042B; Sun, 05 Apr 2026 10:12:23 +0100 (BST)
From: Sean Whitton <spwhitton@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>, Samuel Morris <scmorris.dev@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#80689: [PATCH 2/2] add shell-command-finished-hook
In-Reply-To: <86fr5foo7m.fsf@HIDDEN>
References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
 <ef6669abce4d126d4c55dcdba0246558c826c13d.1774821272.git.scmorris.dev@HIDDEN>
 <865x6dqp9z.fsf@HIDDEN>
 <CAEkeNzhzd=szHKx5waOsXw8EE0pp8JQR6EoWhHo-v0DvvGYWtA@HIDDEN>
 <86fr5foo7m.fsf@HIDDEN>
Date: Sun, 05 Apr 2026 10:12:23 +0100
Message-ID: <87mrzhg494.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Eli Zaretskii <eliz@HIDDEN> [31/Mar  9:20pm +03] wrote:
>> From: Samuel Morris <scmorris.dev@HIDDEN>
>> Date: Tue, 31 Mar 2026 11:16:22 -0600
>> Cc: 80689 <at> debbugs.gnu.org
>>
>>  > This hook is run by 'shell-command-sentinel' when an asynchronous she=
ll
>>  > command process exits or is signalled.  Each function is called with =
two
>>  > arguments: PROCESS and SIGNAL.
>>
>>  Thanks, but could you please describe the rationale and perhaps
>>  describe a couple of use cases where such a hook could needed?
>>
>> Yes, of course. For my immediate use-case, I have emacs trigger a
>> desktop notification when an asynchronous process completes, and
>> display the buffer in a configurable way, in particular, resetting
>> POINT to the beginning of the buffer, and setting the buffer to text
>> mode when the inferior process dies so I=E2=80=99m not trying to signal =
a dead
>> process.
>>
>> But I was really not thinking this through carefully enough. What if I
>> want to process more than just the sighup signal, or override more
>> behavior in shell-command-sentinel, or do things differently per async
>> shell buffer? What I really want is a customizable sentinel, while
>> still avoiding rewriting all of shell-command to point to my
>> version. So something like this in shell-command:
>>
>> ;; before
>> (set-process-sentinel proc #'shell-command-sentinel)
>> ;; after
>> (set-process-sentinel proc shell-command-sentinel-function)
>>
>> Where shell-command-sentinel-function points to shell-command-sentinel
>> by default. That way I can start adding full, programmatic two-way
>> communication between emacs and the subprocess. If it is okay with
>> you, I would like to resubmit with that change. What are your
>> thoughts? And thank you very much for taking the time to look at this.
>
> I'm beginning to think that shell-command is not the right tool for
> such flexible jobs.  Isn't it easier to just write your own command,
> and then do all of that in the sentinel that you write?
>
> But I guess we could also let users and Lisp programs customize the
> sentinel of shell-command.  Sean and Stefan, WDYT?

Instead of a variable to let-bind around calls to shell-command, we
could also add a new optional argument to shell-command.  Samuel, what
do you think of that?

I agree with Stefan about making shell-command return the process
object.

--=20
Sean Whitton




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 4 Apr 2026 07:33:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 04 03:33:40 2026
Received: from localhost ([127.0.0.1]:41900 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w8vVj-0001sm-VV
	for submit <at> debbugs.gnu.org; Sat, 04 Apr 2026 03:33:40 -0400
Received: from mout.gmx.net ([212.227.17.22]:37363)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael.albinus@HIDDEN>)
 id 1w8vVh-0001sP-CD
 for 80689 <at> debbugs.gnu.org; Sat, 04 Apr 2026 03:33:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de;
 s=s31663417; t=1775288011; x=1775892811; i=michael.albinus@HIDDEN;
 bh=hlEcRhyOL32kt4mu9QTjPBtuCngmSnQOUuxy66DrtaM=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=t30ZJVb1m+ww8j0PYferP+PiLB66vwjGWVpAY74RsnIAnLob/AlYOoyF28LAxoN/
 sRNFpxUiJrxeJbZM9vPEIUpjlyzX6fB1371mj81ejgJelwJcEkUYX5w2+uhuQnLte
 qXWMD+sWGNbP/lMppwOFMBqgBnIsg17yhit+D7Txxz8SJOEszOFpBtzl6fn6TbHi2
 D/DHQTYwKVzn5dFFsDuYzw6RMi8BsOyuhYbJz4izRpHkACG39tYDQshLueQ1veebh
 Z9vOwgGpKXaiTtxIDjCaqStTP8MtJHjELNKguUE8b0mH8gYrjbhdHGPrSeixHIMsM
 YQ7q7/DIU0cCZEsw1g==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from client.hidden.invalid by mail.gmx.net (mrgmx105
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mnpru-1vgg6r1FhS-00jiNc; Sat, 04
 Apr 2026 09:33:31 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: Samuel Morris <scmorris.dev@HIDDEN>
Subject: Re: bug#80689: [PATCH 2/2] add shell-command-sentinel-function
In-Reply-To: <CAEkeNziOjf_j63iU38u-XBneq4TRfBZnnhswCK3bfvkFJ1Jn8Q@HIDDEN>
References: <87341cfr1f.fsf@HIDDEN>
 <573a7f187cdabba8c6b7a4782be904ba12da0568.1775230196.git.scmorris.dev@HIDDEN>
 <CAEkeNziOjf_j63iU38u-XBneq4TRfBZnnhswCK3bfvkFJ1Jn8Q@HIDDEN>
Date: Sat, 04 Apr 2026 09:33:30 +0200
Message-ID: <874ilrdvsl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:vMxIwQ0eUkQT216XfFWAQlWVQVkWxtHXSfL5+z9LovhaOoEt2qd
 MD03w6hPE/LDgiUsyVi+FtcRI24gtqb3FD7DeVNirtCOxOTy+NRlZI7ew6gyrel43xD0Q7J
 3IQvthaxU1+l62PpS34Kia0n8YwFCrnx+TAT3Lux9+9W2ZTWGagErjZVAXKQ9TgcnaO6a7W
 nB9rCzr/VGrrRgzPaW1KQ==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:66dVBcQvWC8=;D0p+hNrVOrpY/2G5G+Szbro9Ig6
 SyZhHKqRdiViKpCpJdRpyLPHqpMhHISgCq/nqy/8d44avRyOAB2D1cUFHUK+jRdVn6X18zBi7
 lMjEWsctn0AdI+6Oj0Xj3OmDO0HttgP22edej9JBkZMTaTJxoVmH1tD1iSkZzz1b+NfKCZtNk
 WcMlCLfFyx9JgaFrTMsBv2t+9JFf18fch5PxhuDTHPIItbVzLD6hEvHnGGEYlQA9s2UQd5Y3H
 kXuD8tWQGvBBWo7Zl02HE1gDYoXKIbD0QcRQfS26U4oLWopUwCttViXAqedelmZDlMBKBnv8m
 M2qW2F+HQIMQCq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Iaw6RUFGXI8sFxuB
 VZpuJOdQC024Sr1qpqz7bKvVohYX++IQ7kz7Fn5fiutPla3i5adyHWHYyE3xiCmRLqzvmf9vP
 MupkH9S99bkxyo/NId6w3XU/bn7i7bZAu1r8lLLKErbpiA+roicOZaggw3DFcRgac4Z1ZQn/P
 2bB7rULP9zyb18KleHRU2i/7K6rbiBXBcN4kqmoS2TJkz+Sb7+sBqhgAV7eeReAA8UdXuyxSR
 seUz70NV+E9+39462jEi7xOruWKAd08sIL2OLE/iZPLjzLNm7hXN7HUTrf3qmO7clEMv+WqqY
 feguMNllj++H3IY9KWhV04f/DE8P56UM8Lp54Li/85LHRDEushtZRJyMqgPYj+oRHIYgZtrTx
 KKAqXIUMrt3LZmWgObh5cgyIJszUTOIoeil5aH8/MX//qCp6uEMsJpqcBMJUDRPxpWocYmdi7
 ijtWl548aEMLbraNgSGOkFDrOWupFfKwn/XCHuceskp8fmIJvLbakEGPTkqT+RPCoPZ9+QEFw
 op4FTNM6sYxD2chU2DA/oKKDRIOUrU6v7WjIcC9xDW4LWEqi+nX0hXfbKcplM70xm68Fp7B7F
 93OXlTphgEIGXOWoQ6/domDkoJ/ZP46vLFA76gG/6258qX0OIF2ib6mXNBVDDz6YMOENuN+gH
 gS5xmapOx0R2PXDgOrZCHLAiWSktNLa67soYSpeoIDNxZOyEDP5NyMjf4hLf+TKwZ9rbCHIZt
 Tg74Pja21gS/xDdpRF7CrSxn6oQDYFUiF5ECF5nfAPAQN+FpXfQmzGIs69O5NKD5NRyTBkQu+
 WEua8UdHnGQe41QmKYwsGot7GmsWoIpXIIRR/BsefuOahNBXC+OACW01JCmmEk//JC3n7HH4B
 o1anmVJlsWS
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Samuel Morris <scmorris.dev@HIDDEN> writes:

Hi Samuel,

> Same thing here, this patch version just adds in the tramp-compat
> changes to not break older versions of tramp, as Michael rightly
> pointed out.

Thanks, and the same nitpick as in the other message.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 3 Apr 2026 22:55:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 03 18:55:06 2026
Received: from localhost ([127.0.0.1]:36115 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w8nPu-0000NX-5Y
	for submit <at> debbugs.gnu.org; Fri, 03 Apr 2026 18:55:06 -0400
Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]:42433)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <scmorris.dev@HIDDEN>)
 id 1w8nPr-0000Mx-Q2
 for 80689 <at> debbugs.gnu.org; Fri, 03 Apr 2026 18:55:04 -0400
Received: by mail-ej1-x62e.google.com with SMTP id
 a640c23a62f3a-b9c745e18a0so234659566b.1
 for <80689 <at> debbugs.gnu.org>; Fri, 03 Apr 2026 15:55:03 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1775256902; cv=none;
 d=google.com; s=arc-20240605;
 b=cVbZ4RUpaqR6o1uNKEHm3q5E/woqYKYwfWKilr3fzZgYQB3kXQEQehWM/oPPgFPjmL
 6gOAT4m2+AETBl/mMzNOHhzjIHHM9wQwcnpLdrOzkjoh/zKmd3DBbQmPQZMWLWw3fCEB
 GGAXd69ImmFYnK71uzjxwiwZilcqzrJUdopj8zP6SrpPVS55mBttpj+WmyiLTT+nMTth
 4Yc1ma4tt/Jh7T1oX+ZrLL19rbSHHk8I/FIS1rwDlnGKFsBgJOCzpJVz6tUftkJa3Y7l
 N9mOy/At0tXnm0TNQY5mIqFLOtEJ+bzmf8raDNP5MUZIx18xKndKoDnnDonxDnHr2i/m
 /2cA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20240605; 
 h=to:subject:message-id:date:from:in-reply-to:references:mime-version
 :dkim-signature;
 bh=TiCf6SiC6O+aevpAnp6tvElJyt42nB5CzOVlrd8SXjM=;
 fh=W+z1sbw/pAqgN1O7wlJoJTId2shMvNj9lGKZLOWwv0g=;
 b=DCTHwxX1VPUWN5yxrXe2sQ8MvwiAk6i77AvkvtK1PO2Mr+NgeYTwS6OFyAe78+Ar32
 kH9OPZv5D0GGiHTNOmOMYSa+1bAEtO+rhfyg5xAlTMEBRCH0hBfhKdwZwPw6lj5IRRYl
 ZBGoJfAVgDAExjxzaU+6SA7MwYnNWKujilg9wutcF99MJ57PtMtvHUSdnx+X+ZCPTQZx
 0MbzBTtQRfJcWBU1Em4FV4Tvh7dGlqwHTb8Rc0OiZb4OEYk9hyjw3CEYUGwUSdzsrrmn
 SGALn8paucL1vq05lcpn2dz+en//iImnSEz1M5axKydsuzvGI9CvyX359oejhoix3bzv
 /8hg==; darn=debbugs.gnu.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1775256902; x=1775861702; darn=debbugs.gnu.org;
 h=to:subject:message-id:date:from:in-reply-to:references:mime-version
 :from:to:cc:subject:date:message-id:reply-to;
 bh=TiCf6SiC6O+aevpAnp6tvElJyt42nB5CzOVlrd8SXjM=;
 b=HjnWDiGOkBJEsD69+KTmJ0/9cBhsS76TfHIOK20CrlFZ2Qhnsj80Pfmgbs7u+objWi
 QhBREJgx26/q6a6KhbUv4QeaFsGYPAt/sUq+nsLm7lVtGZO7ERw9kRz/3uKYPBsPM0MD
 YMoOTkMTWkudzQLAO/7CvFM1joBnNIoOzToCeF5XAoH1OxZFz3OkAx0M3uKYma9XefHL
 raETjispXK+qKIN+9kHmycKUKBpYvG+qN49wYi041eUIPzm9Fnw2mGjat86AUSsEsClj
 MgPrD7XnA9fsh7H/GlCRMWyhD8RZOS+QKNmPW0PWfL0AAJNNEs+KuAQHcTWIJt4CX6Ce
 nCYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1775256902; x=1775861702;
 h=to:subject:message-id:date:from:in-reply-to:references:mime-version
 :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=TiCf6SiC6O+aevpAnp6tvElJyt42nB5CzOVlrd8SXjM=;
 b=hHtcOqYNrlI9dlqtg/7HaY8VY6umONaZPsDO1HhAxVBDJdfXTzn2d8ZLMd9I3u2LoT
 iTLq/o8+ar4CHFZRg48+FBjkNtfa3H4Qf7EMAh9rXN+9xU+RpSVGfEeX69kR6t5tjJ0K
 okqD4z63z1L+uc+Su9cmVdds6y4R1Ao73EXTqJim7cniaHFH7AgMrgjsm7NGA+6l5NY7
 UFcllNGZLmHWuxdRNzTnseZDPdFEces8sZJ74upHGeqpZD0dqykZY7fYyUpT7znn3BwE
 M2sP7Zwx/xcocQkcJ3zfihLAA4a4y1fAuMm0SBtl7gx8n1X3IJK6ird3SV+1IrqF6Zps
 XUUQ==
X-Gm-Message-State: AOJu0Yxs5Ij0VPaI1y+SVvqmn+d0Kr2COC6N5+9UAIAzFRYGyPeABEzp
 DADxBhvvvLkF/HJvktIQSWuK5MNTPaZ6VCccmv9hr++a3eKC6ix/PSf5aBHunYtNp8ffYAHzfRS
 cOoEYz0lZia2+bFEVg6qAlfJWewmlGnxRtVzCpfk=
X-Gm-Gg: AeBDiev5yqLEj8WQYXP5uz+oZvPesZMsiTp7Wp9Bx6RyQvzbinDpI7M76gbPefS8S/X
 /RhrFP9kZVm1cEqNejzVokcxk0MkV3U1vY/7dvORl7nXojiWnyRbDr/L0Pr5J1+m9q0u5qPNXFw
 CavX5XeFEQ96lgL925xonY3HegasMFEvxZC25nbtyE4F08kLAfk94TnhC07KhP7l/DZGAcOZjIn
 Ma3NvkifgwO4Jpvq0vSwntXgn+Rs0li0O0NGSfxlYqIj5q63XusCmpvQxQGfI/ONQc8bFzKROUv
 Sr3r
X-Received: by 2002:a17:906:f5a0:b0:b97:6d1b:4be8 with SMTP id
 a640c23a62f3a-b9c46e2677fmr366161666b.10.1775256901963; Fri, 03 Apr 2026
 15:55:01 -0700 (PDT)
MIME-Version: 1.0
References: <87341cfr1f.fsf@HIDDEN>
 <573a7f187cdabba8c6b7a4782be904ba12da0568.1775230196.git.scmorris.dev@HIDDEN>
In-Reply-To: <573a7f187cdabba8c6b7a4782be904ba12da0568.1775230196.git.scmorris.dev@HIDDEN>
From: Samuel Morris <scmorris.dev@HIDDEN>
Date: Fri, 3 Apr 2026 16:54:49 -0600
X-Gm-Features: AQROBzDv3HBosg2YITGVWXfqrSvAcDQQCGJgnnInDcpWCdbpq5qQ8Gjwoso2hdo
Message-ID: <CAEkeNziOjf_j63iU38u-XBneq4TRfBZnnhswCK3bfvkFJ1Jn8Q@HIDDEN>
Subject: Re: [PATCH 2/2] add shell-command-sentinel-function
To: 80689 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary="00000000000006d358064e9635e7"
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80689
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--00000000000006d358064e9635e7
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Fri, Apr 3, 2026 at 4:48=E2=80=AFPM <scmorris.dev@HIDDEN> wrote:

> From: "S.C. Morris" <scmorris.dev@HIDDEN>
>
> * lisp/simple.el (shell-command-sentinel-function): New defvar,
> defaulting to `shell-command-sentinel', passed to
> `set-process-sentinel' for asynchronous shell commands.  Lisp
> programs can let-bind it to replace the sentinel entirely.
> (shell-command): Use `shell-command-sentinel-function' instead of
> the literal `#'shell-command-sentinel'.
>
> * lisp/net/tramp.el (tramp-handle-shell-command): Likewise.
>
> * etc/NEWS: Document `shell-command-sentinel-function'.
> ---
>  etc/NEWS                 | 7 +++++++
>  lisp/net/tramp-compat.el | 5 +++++
>  lisp/net/tramp.el        | 2 +-
>  lisp/simple.el           | 8 +++++++-
>  4 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/etc/NEWS b/etc/NEWS
> index 0a9f197eaf8..ef4b0cce20f 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -4330,6 +4330,13 @@ return the output buffer name.  It takes precedenc=
e
> over
>  'shell-command-unique-output-buffer-p', 'shell-command-buffer-name', and
>  'shell-command-buffer-name-async'.
>
> ++++
> +** New variable 'shell-command-sentinel-function'.
> +This variable holds the process sentinel used for asynchronous shell
> +commands.  Lisp programs can let-bind it around a call to
> +'shell-command' to replace the sentinel entirely, allowing custom
> +handling of any process status.
> +
>  +++
>  ** 'make-vtable' can create an empty vtable.
>  It is now possible to create a vtable without data, by leaving the
> diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
> index 43a097f65e0..26aed661e2e 100644
> --- a/lisp/net/tramp-compat.el
> +++ b/lisp/net/tramp-compat.el
> @@ -245,6 +245,11 @@ 'tramp-compat-seq-keep
>    (defvar shell-command-unique-output-buffer-p nil
>      "If non-nil, give each shell command output its own uniquely named
> buffer."))
>
> +;; `shell-command-sentinel-function' is new in Emacs 31.1.
> +(unless (boundp 'shell-command-sentinel-function)
> +  (defvar shell-command-sentinel-function #'shell-command-sentinel
> +    "Function used as the process sentinel for asynchronous shell
> commands."))
> +
>  (dolist (elt (apropos-internal (rx bos "tramp-compat-") #'functionp))
>    (function-put elt 'tramp-suppress-trace t))
>
> diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
> index f9abe4d6135..5ce65b614bb 100644
> --- a/lisp/net/tramp.el
> +++ b/lisp/net/tramp.el
> @@ -5746,7 +5746,7 @@ tramp-handle-shell-command
>                   ((not (eq major-mode 'shell-mode))
>                    (shell-mode)))
>                 (set-process-filter p #'comint-output-filter)
> -               (set-process-sentinel p #'shell-command-sentinel)
> +               (set-process-sentinel p shell-command-sentinel-function)
>                 (when error-file
>                   (add-function
>                    :after (process-sentinel p)
> diff --git a/lisp/simple.el b/lisp/simple.el
> index fea990c09d7..04a28053c8d 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -4808,7 +4808,7 @@ shell-command
>                  (setq-local revert-buffer-function
>                              (lambda (&rest _)
>                                (async-shell-command command buffer)))
> -                (set-process-sentinel proc #'shell-command-sentinel)
> +                (set-process-sentinel proc
> shell-command-sentinel-function)
>                 ;; Use the comint filter for proper handling of
>                 ;; carriage motion (see comint-inhibit-carriage-motion).
>                  (set-process-filter proc #'comint-output-filter)
> @@ -4950,6 +4950,12 @@ display-message-or-buffer
>                     (display-buffer (current-buffer) action frame))))))))
>
>
> +(defvar shell-command-sentinel-function #'shell-command-sentinel
> +  "Function used as the process sentinel for asynchronous shell commands=
.
> +The value is passed directly to `set-process-sentinel'.  Lisp programs
> +can let-bind this variable around a call to `shell-command' to replace
> +the sentinel entirely, allowing custom handling of any process status.")
> +
>  ;; We have a sentinel to prevent insertion of a termination message
>  ;; in the buffer itself, and to set the point in the buffer when
>  ;; `shell-command-dont-erase-buffer' is non-nil.
> --
> 2.52.0
>
> Same thing here, this patch version just adds in the tramp-compat
changes to not break older versions of tramp, as Michael rightly
pointed out.

--00000000000006d358064e9635e7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Fri, Apr 3, 2026 at 4:48=E2=80=AFPM &l=
t;<a href=3D"mailto:scmorris.dev@HIDDEN">scmorris.dev@HIDDEN</a>&gt; =
wrote:</div><div class=3D"gmail_quote gmail_quote_container"><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid=
 rgb(204,204,204);padding-left:1ex">From: &quot;S.C. Morris&quot; &lt;<a hr=
ef=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmorris.dev@HIDDEN=
om</a>&gt;<br>
<br>
* lisp/simple.el (shell-command-sentinel-function): New defvar,<br>
defaulting to `shell-command-sentinel&#39;, passed to<br>
`set-process-sentinel&#39; for asynchronous shell commands.=C2=A0 Lisp<br>
programs can let-bind it to replace the sentinel entirely.<br>
(shell-command): Use `shell-command-sentinel-function&#39; instead of<br>
the literal `#&#39;shell-command-sentinel&#39;.<br>
<br>
* lisp/net/tramp.el (tramp-handle-shell-command): Likewise.<br>
<br>
* etc/NEWS: Document `shell-command-sentinel-function&#39;.<br>
---<br>
=C2=A0etc/NEWS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0| 7 +++++++<br>
=C2=A0lisp/net/tramp-compat.el | 5 +++++<br>
=C2=A0lisp/net/tramp.el=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 2 +-<br>
=C2=A0lisp/simple.el=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 8 +++++++-<b=
r>
=C2=A04 files changed, 20 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/etc/NEWS b/etc/NEWS<br>
index 0a9f197eaf8..ef4b0cce20f 100644<br>
--- a/etc/NEWS<br>
+++ b/etc/NEWS<br>
@@ -4330,6 +4330,13 @@ return the output buffer name.=C2=A0 It takes preced=
ence over<br>
=C2=A0&#39;shell-command-unique-output-buffer-p&#39;, &#39;shell-command-bu=
ffer-name&#39;, and<br>
=C2=A0&#39;shell-command-buffer-name-async&#39;.<br>
<br>
++++<br>
+** New variable &#39;shell-command-sentinel-function&#39;.<br>
+This variable holds the process sentinel used for asynchronous shell<br>
+commands.=C2=A0 Lisp programs can let-bind it around a call to<br>
+&#39;shell-command&#39; to replace the sentinel entirely, allowing custom<=
br>
+handling of any process status.<br>
+<br>
=C2=A0+++<br>
=C2=A0** &#39;make-vtable&#39; can create an empty vtable.<br>
=C2=A0It is now possible to create a vtable without data, by leaving the<br=
>
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el<br>
index 43a097f65e0..26aed661e2e 100644<br>
--- a/lisp/net/tramp-compat.el<br>
+++ b/lisp/net/tramp-compat.el<br>
@@ -245,6 +245,11 @@ &#39;tramp-compat-seq-keep<br>
=C2=A0 =C2=A0(defvar shell-command-unique-output-buffer-p nil<br>
=C2=A0 =C2=A0 =C2=A0&quot;If non-nil, give each shell command output its ow=
n uniquely named buffer.&quot;))<br>
<br>
+;; `shell-command-sentinel-function&#39; is new in Emacs 31.1.<br>
+(unless (boundp &#39;shell-command-sentinel-function)<br>
+=C2=A0 (defvar shell-command-sentinel-function #&#39;shell-command-sentine=
l<br>
+=C2=A0 =C2=A0 &quot;Function used as the process sentinel for asynchronous=
 shell commands.&quot;))<br>
+<br>
=C2=A0(dolist (elt (apropos-internal (rx bos &quot;tramp-compat-&quot;) #&#=
39;functionp))<br>
=C2=A0 =C2=A0(function-put elt &#39;tramp-suppress-trace t))<br>
<br>
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el<br>
index f9abe4d6135..5ce65b614bb 100644<br>
--- a/lisp/net/tramp.el<br>
+++ b/lisp/net/tramp.el<br>
@@ -5746,7 +5746,7 @@ tramp-handle-shell-command<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((not (eq ma=
jor-mode &#39;shell-mode))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(shell=
-mode)))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-process-filter=
 p #&#39;comint-output-filter)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(set-process-sentin=
el p #&#39;shell-command-sentinel)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(set-process-sentin=
el p shell-command-sentinel-function)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when error-file<br=
>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (add-functio=
n<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0:after=
 (process-sentinel p)<br>
diff --git a/lisp/simple.el b/lisp/simple.el<br>
index fea990c09d7..04a28053c8d 100644<br>
--- a/lisp/simple.el<br>
+++ b/lisp/simple.el<br>
@@ -4808,7 +4808,7 @@ shell-command<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq-local r=
evert-buffer-function<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(lambda (&amp;rest _)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(async-shell-command command buffer))=
)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-process-senti=
nel proc #&#39;shell-command-sentinel)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-process-senti=
nel proc shell-command-sentinel-function)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Use the comint f=
ilter for proper handling of<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; carriage motion =
(see comint-inhibit-carriage-motion).<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(set-process-=
filter proc #&#39;comint-output-filter)<br>
@@ -4950,6 +4950,12 @@ display-message-or-buffer<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (disp=
lay-buffer (current-buffer) action frame))))))))<br>
<br>
<br>
+(defvar shell-command-sentinel-function #&#39;shell-command-sentinel<br>
+=C2=A0 &quot;Function used as the process sentinel for asynchronous shell =
commands.<br>
+The value is passed directly to `set-process-sentinel&#39;.=C2=A0 Lisp pro=
grams<br>
+can let-bind this variable around a call to `shell-command&#39; to replace=
<br>
+the sentinel entirely, allowing custom handling of any process status.&quo=
t;)<br>
+<br>
=C2=A0;; We have a sentinel to prevent insertion of a termination message<b=
r>
=C2=A0;; in the buffer itself, and to set the point in the buffer when<br>
=C2=A0;; `shell-command-dont-erase-buffer&#39; is non-nil.<br>
-- <br>
2.52.0<br>
<br></blockquote>Same thing here, this patch version just adds in the tramp=
-compat<br>changes to not break older versions of tramp, as Michael rightly=
<br>pointed out.</div></div>

--00000000000006d358064e9635e7--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 3 Apr 2026 22:48:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 03 18:48:13 2026
Received: from localhost ([127.0.0.1]:36038 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w8nJE-0008Qw-52
	for submit <at> debbugs.gnu.org; Fri, 03 Apr 2026 18:48:12 -0400
Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]:50523)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <scmorris.dev@HIDDEN>)
 id 1w8nJB-0008Qb-5h
 for 80689 <at> debbugs.gnu.org; Fri, 03 Apr 2026 18:48:09 -0400
Received: by mail-ot1-x32c.google.com with SMTP id
 46e09a7af769-7d9bba96f7dso1154884a34.1
 for <80689 <at> debbugs.gnu.org>; Fri, 03 Apr 2026 15:48:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1775256488; x=1775861288; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Utl38hQTnBZMT9gYjbUIbGscjlhySLbRv8/5MbYXWlw=;
 b=AsF1F+4xx6w/RH8Lr44H3X/HZ/NvP6u0hdh3HmUiafWYDjPRgICmg19+ew0Tw0Qrnd
 AUAHC8ET9zcUNm5Kx/aVf4QZqeSxC/EouSYjOpMKfVaC2fvixDaPQ2kuoNvuOng+gj+2
 ybnpnm4r5LfXzLBBuoH/8HXCbdgwOgW6vEqAlmIj4HJ/JO1DlEzA3KzXMr30Zlp9U5kP
 +8zuTk7jOTteTtFcp1pCIBKk/d+O8bPTrH8cNPelGCyaniadQO0i/3FsRyQWfuSEg2ww
 mOWBkf/0OHsLaAHi2IfGzPkly19P97AYyU70JcUh+Ad4QVJy6HHZST4yBe7Vu6Q26tdb
 hBCQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1775256488; x=1775861288;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=Utl38hQTnBZMT9gYjbUIbGscjlhySLbRv8/5MbYXWlw=;
 b=lmHx0Or/aynKlcWIG6hx9UfTAopOT5KWEbHg/bSmOz9OcDnIEirkwIrMWuiAAtOS41
 YTB6n2OtLGKmVC7gMro8XbHAA81spMyuvgXcsUbv2ZTEZ9YXuzRBgQXveLnyrWTtuDW3
 XEPAuEaeA29NUzLcMtoy6kikRBbUhEGff3ooMpquxIzsCaGSHmy+/NF15qTKpWuc0sg9
 3p0PGE8I6H+ekru3Q4SoQrGVTjVgzrmuymsW1YDBjzwUPFFlLuSiEN3wsGMzDT19gx/w
 QruV7P2rVEED2qh5F9+krAZRasDN41OafwaFjTcq2XiZcIwZHmFnxAMLGtr/IEFL/EUO
 7TOQ==
X-Gm-Message-State: AOJu0YzbPgGcPRC+kCc+PpMXNofmuu6Z9bHe17+m3/3ayXFGel17c0ej
 R6MUAFXXenIolqqfdjEvK3Ah4Mc7i2z8ZBLIfpkAHgGydNMVByG2tR6LKW1BrC8g
X-Gm-Gg: ATEYQzygVsqlymSSp/YVH9KcShPY489ggEjUIhT7pm5x2ay4jFfJIRMbV+WMz3WiwJP
 QM/pKI8oxclzKrE6bTYr4sZy9vTPNRMqVsfUiq1BpmRqGmvjpj/JglX/qAtiIgYmRgeMw/PwBrO
 KqD3Rpfup4Cd/RLXZJ+8bm2xSeqopQ9smJWm/5DA9ro7ViKJor8pNeyjrT9jAiYfuJllSSWmhB/
 ruVSejcU1EFjUAGyJQhD/9bndLqGOKXS7h4BNvqeshR8kpKyr3fiChiUd+4c+X99I7I6fDyS+0t
 JCWLXW5hNiLlNo6m0REba23Dw3ygEq+EjmhgRskzRApH+fGDREHfWfjhCKVSf/YSG2x/Zdj2Xji
 r99Cjsn0v+I/H61A3KUwVDFbM6nppOW6QFJ8N4qEvnUnwcx6ttzYGGSRnUXYJPLLrn0lbJDocRP
 8U55hTnIsgH05/OfpeK6TWrzkv
X-Received: by 2002:a05:6820:1384:b0:67c:1e60:3e90 with SMTP id
 006d021491bc7-6821e869719mr2394444eaf.6.1775256487825; 
 Fri, 03 Apr 2026 15:48:07 -0700 (PDT)
Received: from envy.tail20243e.ts.net ([2601:282:1d00:ad10::7451])
 by smtp.gmail.com with ESMTPSA id
 006d021491bc7-680a63c7fd1sm4381278eaf.8.2026.04.03.15.48.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 03 Apr 2026 15:48:06 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: 80689 <at> debbugs.gnu.org
Subject: [PATCH 2/2] add shell-command-sentinel-function
Date: Fri,  3 Apr 2026 16:48:03 -0600
Message-ID: <573a7f187cdabba8c6b7a4782be904ba12da0568.1775230196.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <87341cfr1f.fsf@HIDDEN>
References: <87341cfr1f.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80689
Cc: "S.C. Morris" <scmorris.dev@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

From: "S.C. Morris" <scmorris.dev@HIDDEN>

* lisp/simple.el (shell-command-sentinel-function): New defvar,
defaulting to `shell-command-sentinel', passed to
`set-process-sentinel' for asynchronous shell commands.  Lisp
programs can let-bind it to replace the sentinel entirely.
(shell-command): Use `shell-command-sentinel-function' instead of
the literal `#'shell-command-sentinel'.

* lisp/net/tramp.el (tramp-handle-shell-command): Likewise.

* etc/NEWS: Document `shell-command-sentinel-function'.
---
 etc/NEWS                 | 7 +++++++
 lisp/net/tramp-compat.el | 5 +++++
 lisp/net/tramp.el        | 2 +-
 lisp/simple.el           | 8 +++++++-
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 0a9f197eaf8..ef4b0cce20f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4330,6 +4330,13 @@ return the output buffer name.  It takes precedence over
 'shell-command-unique-output-buffer-p', 'shell-command-buffer-name', and
 'shell-command-buffer-name-async'.
 
++++
+** New variable 'shell-command-sentinel-function'.
+This variable holds the process sentinel used for asynchronous shell
+commands.  Lisp programs can let-bind it around a call to
+'shell-command' to replace the sentinel entirely, allowing custom
+handling of any process status.
+
 +++
 ** 'make-vtable' can create an empty vtable.
 It is now possible to create a vtable without data, by leaving the
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 43a097f65e0..26aed661e2e 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -245,6 +245,11 @@ 'tramp-compat-seq-keep
   (defvar shell-command-unique-output-buffer-p nil
     "If non-nil, give each shell command output its own uniquely named buffer."))
 
+;; `shell-command-sentinel-function' is new in Emacs 31.1.
+(unless (boundp 'shell-command-sentinel-function)
+  (defvar shell-command-sentinel-function #'shell-command-sentinel
+    "Function used as the process sentinel for asynchronous shell commands."))
+
 (dolist (elt (apropos-internal (rx bos "tramp-compat-") #'functionp))
   (function-put elt 'tramp-suppress-trace t))
 
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index f9abe4d6135..5ce65b614bb 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5746,7 +5746,7 @@ tramp-handle-shell-command
                  ((not (eq major-mode 'shell-mode))
                   (shell-mode)))
 		(set-process-filter p #'comint-output-filter)
-		(set-process-sentinel p #'shell-command-sentinel)
+		(set-process-sentinel p shell-command-sentinel-function)
 		(when error-file
 		  (add-function
 		   :after (process-sentinel p)
diff --git a/lisp/simple.el b/lisp/simple.el
index fea990c09d7..04a28053c8d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4808,7 +4808,7 @@ shell-command
                 (setq-local revert-buffer-function
                             (lambda (&rest _)
                               (async-shell-command command buffer)))
-                (set-process-sentinel proc #'shell-command-sentinel)
+                (set-process-sentinel proc shell-command-sentinel-function)
 		;; Use the comint filter for proper handling of
 		;; carriage motion (see comint-inhibit-carriage-motion).
                 (set-process-filter proc #'comint-output-filter)
@@ -4950,6 +4950,12 @@ display-message-or-buffer
 		    (display-buffer (current-buffer) action frame))))))))
 
 
+(defvar shell-command-sentinel-function #'shell-command-sentinel
+  "Function used as the process sentinel for asynchronous shell commands.
+The value is passed directly to `set-process-sentinel'.  Lisp programs
+can let-bind this variable around a call to `shell-command' to replace
+the sentinel entirely, allowing custom handling of any process status.")
+
 ;; We have a sentinel to prevent insertion of a termination message
 ;; in the buffer itself, and to set the point in the buffer when
 ;; `shell-command-dont-erase-buffer' is non-nil.
-- 
2.52.0





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 3 Apr 2026 07:21:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 03 03:21:10 2026
Received: from localhost ([127.0.0.1]:55218 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w8Yq5-0000Vw-JB
	for submit <at> debbugs.gnu.org; Fri, 03 Apr 2026 03:21:10 -0400
Received: from mout.gmx.net ([212.227.15.18]:34395)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael.albinus@HIDDEN>)
 id 1w8Yq3-0000Uo-K4
 for 80689 <at> debbugs.gnu.org; Fri, 03 Apr 2026 03:21:08 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de;
 s=s31663417; t=1775200861; x=1775805661; i=michael.albinus@HIDDEN;
 bh=aMjTKwKYYRU5Pl2q7c3BE1DsHqA0ioFCd0K0YaguKqI=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=DtUwKWgbHMeM3x1U0eIlaGEbddNZCB7Nhe8ZiOCIyLSxlejzJdjdOvWowg/Jo+rL
 o2YB8tYEErdxsvZKSCC/ZDJ327q81eYfw6D+ue2M1L3GDdgN8tsA+Prsqa7pCYORE
 gM4Uxtj6cBOjufUlcelwymIMfNCS22PMINX5xWNamz6q4jKqmdGlXOe9vjEgidUCL
 l0LggxHLrzVx5GA6fTCVbDZBvLt1/waOiL6jVkQ2xLVT4vL3Xn/43yVKJXmDs8CBW
 xmCiFc3VRLdR+7WQMk0Z6/8nZSEu4a1ZTLRSaVHjo6MpzAKj0DCKBh6IF2wjGMOXN
 EYN/bBkk7dMMIKSZdA==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from client.hidden.invalid by mail.gmx.net (mrgmx005
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MdvqW-1vXqyR2FxG-00cVba; Fri, 03
 Apr 2026 09:21:01 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: Samuel Morris <scmorris.dev@HIDDEN>
Subject: Re: bug#80689: [PATCH 2/2] add shell-command-sentinel-function
In-Reply-To: <CAEkeNzgsJGYcfW5m+gpGrVZYXoMgT3u9_qu=OKrOCLho+dObjg@HIDDEN>
References: <87y0j7gnpr.fsf@HIDDEN>
 <9767dd98614676dc5341d6a2e8e7c95affbf744a.1775143646.git.scmorris.dev@HIDDEN>
 <CAEkeNzgsJGYcfW5m+gpGrVZYXoMgT3u9_qu=OKrOCLho+dObjg@HIDDEN>
Date: Fri, 03 Apr 2026 09:21:00 +0200
Message-ID: <87341cfr1f.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.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ajDg7mZqgpy/k4x2MltfIwb051k42EGOCjNYTgZsVDxz2n7lp2pbkPWdv+p5LgvNC
 55rvsNpb9q9sLjARtbkBAS7Xvbkp1yR2XJCwXlr+bkGiGSpWWNa+TQ1RZtsTBYYDda/uqa/Fe
 /9niyJlIH4MsLR5qWfVUdR9OYweE7DI4Bbaz5X38bSGZrpEkP0iWmGotDZnExHz3Ss5/ilEhC
 MbDVxUbPnvev1ySHLCJGn2lCQ+0Y3HdNk8K4Q0KFzZyj2kZF5mcUlAXrNjADh2PX3devVQIBN
 qMqbCOimltuj7Oj0fwnoaWh86JeNBmAM4IX/sblfY161VS3Ix8d9E1SzI1LLHD4hg8nTZnqxw
 patPuZroZlN84fFIIJDzo6pSCghxb6Kd8B7L+JwvTcKpAPd10JdCVFRbYF5uiQflQg7MPvBA7
 QuoFPEq4ZPLTefUH2SYUWxIS3u11PpQa8CIOXQxEjBl9mEPG84d6GjDZC2bqTycZZCNSMnxET
 QpucyKAShIi
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Samuel Morris <scmorris.dev@HIDDEN> writes:

Hi Samuel,

> So this is just a follow-up proposal based on the feedback from the
> previous thread, integrating that feedback, in particular:
>
> * I switched from using the exit hook to just making the entire
>   shell-command sentinel configurable to packages.
> * I mirrored those changes in tramp

Thanks. Same compatibility issue for Tramp as reported.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 2 Apr 2026 20:42:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 02 16:42:47 2026
Received: from localhost ([127.0.0.1]:47915 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w8OsI-0005QA-Pm
	for submit <at> debbugs.gnu.org; Thu, 02 Apr 2026 16:42:47 -0400
Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:46368)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <scmorris.dev@HIDDEN>)
 id 1w8OsG-0005Py-Cf
 for 80689 <at> debbugs.gnu.org; Thu, 02 Apr 2026 16:42:45 -0400
Received: by mail-ed1-x533.google.com with SMTP id
 4fb4d7f45d1cf-66e209d03b8so1263365a12.1
 for <80689 <at> debbugs.gnu.org>; Thu, 02 Apr 2026 13:42:44 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1775162563; cv=none;
 d=google.com; s=arc-20240605;
 b=G22w8A4AI0/4EZQNjh7j4wpdtb+PyWh4z/S7EqD/k3Fjax87HlO7ucHU89UsEbTgVB
 Y2RwsAJtQo3c1q7rkJnba9AjJEqxwk4jSMc09B/hoRap7MP3FDYxKAbgLlnccjWTlHwX
 7xIImfZaq7jxbnZ/qrDT6a3PJXLP5k+tl1txtDkFybH4c4/dHcGvEzqR+qBDXZzPkjrL
 evVjvqYEZJ4HmqXoDJ3RwD0ic2+C1KggyuxAGSS9JAWh2sTmFY0rbc9xnAhXnKBr/I8Q
 VwM9uHWHT4/knQ9ySCIS9yCKePHGdmqYuvXIfPvbnvnhdSZr0dVRUU+rJjVZBBi04kHh
 TvLg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20240605; 
 h=to:subject:message-id:date:from:in-reply-to:references:mime-version
 :dkim-signature;
 bh=0E8iTCxuotoGeKJ9ueDKt227mqZvjSaPI9uPYKb8NAI=;
 fh=W+z1sbw/pAqgN1O7wlJoJTId2shMvNj9lGKZLOWwv0g=;
 b=hKn29qsGCJsKlYX0VZHhirQQPbriEEgvUHEQ50BqCV4dImOV7yrqwcRIHxIEZeyCJz
 RbomC3tDzGV2s9rZ8Vmwlb68ztehX38Q/C2gppB4QblZTYbExJW5HL3JjiglQRl3QRSU
 snRAyEDwBH2cOKdfm0XSqC4Ea3XwaIguMoj2e+Z4gsmoodWqAN8pK5kHH0uQD5/jRUtH
 ctviU7NYDyT2hOg/A/sZWHXyw+vs7SKzcbcifLxAa9AXHe6kJ6TPHozAvIPlXQuBcSvi
 hvXTAtK4lJpscQNpUSoGp9h9KffFfLqrk5v558ZgzcVLqjOFOdc3EtnKMKLzDvCBQvQ3
 W6PQ==; darn=debbugs.gnu.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1775162563; x=1775767363; darn=debbugs.gnu.org;
 h=to:subject:message-id:date:from:in-reply-to:references:mime-version
 :from:to:cc:subject:date:message-id:reply-to;
 bh=0E8iTCxuotoGeKJ9ueDKt227mqZvjSaPI9uPYKb8NAI=;
 b=NTHxS7e5czY3HfKE9drPNAnB5MWc+WVHGs9PBn3YQ23I8TGt18PMagSUK5S1Ty6BKO
 600gpXk9jOsXaEy8CxdQoVV2rXWTQh6XFTpsiwioSULWMAmuJew7sn/hw6Q3yWp2zDP/
 EpFnO6NjkMCLlLbPGgMEPO6gVqFx70vZpjLsOXVvkwrl7hQhFAy3ix/BSBvktLoo89ow
 5ZFTy1zgN51u6w3cjjBAD/AObsaxoObdRr52ea3fmetAaZupwEg82hV4Se2Z+yy2xQCM
 bm1k73zIN4M7BAY7ndpgTXVxO15r3OZKTo0320uiEPwehrqZ4/RukeM7umule2w51zaY
 R63A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1775162563; x=1775767363;
 h=to:subject:message-id:date:from:in-reply-to:references:mime-version
 :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=0E8iTCxuotoGeKJ9ueDKt227mqZvjSaPI9uPYKb8NAI=;
 b=aJLRsAZhY27k+y6BdlxwEmiv5nPME/e9Nyy6IUP6Ge4OsyCZiEQAz9uZvyKWTPEkWd
 7DR58iZgsw3P/4nvCzVjFl84xB/uhQ+KVojQg/uSsLVQ+1xwm7TzeNdNXlf4F8GXmKvE
 OVaEvjVGUnWlodaF84oBqtQiOkFG3azXZ550Qz276YFVhM928M5bIaqd6y0uj2esJlXG
 22hD/nNt/l7mJG9r33BITW1JgTWSl/M1mRVrayklZskdSMoKrAJeudEnukF7YZHCBB7F
 ClFScRKWtpTEON/GjsHZWOLGSqEBycbkOXib3M85yLDEkk6eFV/0tosv3EKxT/BJrJSk
 x2OA==
X-Gm-Message-State: AOJu0YwFvyxwa9n/BLbvP2RYfPYVDnZIQ9se4mqTWNyTgUzL06Cd7Xlj
 04uIntcTLAHfsaFrAB2g4feymZlQzK2px2pk49HJcCRyymArtirk2b7vMHOo2oZoJ4ksGwrtUbY
 Wb/yKb7aUS6myYjzUIaRsyNlNh2nqqVWjELq1ivk=
X-Gm-Gg: ATEYQzxGj3eNGkwxNMvrprD2PoeJUIel6UpTXbLPZVhtCgZP/V818sYAvETA2kgcqHH
 +CwwpstwPWY59FYGPwknqtzh5xGIxYxN3ZrdN+P3UlIFpVIKEvQ+EORiaFqQ97ClW9zDiecFqHx
 gjYibB0bm5j7FbHNnm0HCTXJYE/rFm+8IDepdFnXgxst9Ex21YmPMwozfm1fh4Mg4rjmtU0u33s
 JzAjGQN7UJgLZ/230tzSf+zwcoyMHaadFBkJ+AGwM3Oz6QZRJ7stS6Hmv6/RnixBYKoHyjLgjOq
 /Kw+
X-Received: by 2002:a17:906:6a10:b0:b9b:6dd2:f118 with SMTP id
 a640c23a62f3a-b9c6742297amr18375166b.12.1775162562726; Thu, 02 Apr 2026
 13:42:42 -0700 (PDT)
MIME-Version: 1.0
References: <87y0j7gnpr.fsf@HIDDEN>
 <9767dd98614676dc5341d6a2e8e7c95affbf744a.1775143646.git.scmorris.dev@HIDDEN>
In-Reply-To: <9767dd98614676dc5341d6a2e8e7c95affbf744a.1775143646.git.scmorris.dev@HIDDEN>
From: Samuel Morris <scmorris.dev@HIDDEN>
Date: Thu, 2 Apr 2026 14:42:31 -0600
X-Gm-Features: AQROBzAxUyVEKhJSnpTaqz03VmnGLyHGU-ej-0UkOLdGOZzqCwJCTZ85PcGcEOU
Message-ID: <CAEkeNzgsJGYcfW5m+gpGrVZYXoMgT3u9_qu=OKrOCLho+dObjg@HIDDEN>
Subject: Re: [PATCH 2/2] add shell-command-sentinel-function
To: 80689 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary="000000000000f84e6a064e803d14"
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80689
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--000000000000f84e6a064e803d14
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Apr 2, 2026 at 2:29=E2=80=AFPM <scmorris.dev@HIDDEN> wrote:

> From: "S.C. Morris" <scmorris.dev@HIDDEN>
>
> * lisp/simple.el (shell-command-sentinel-function): New defvar,
> defaulting to `shell-command-sentinel', passed to
> `set-process-sentinel' for asynchronous shell commands.  Lisp
> programs can let-bind it to replace the sentinel entirely.
> (shell-command): Use `shell-command-sentinel-function' instead of
> the literal `#'shell-command-sentinel'.
>
> * lisp/net/tramp.el (tramp-handle-shell-command): Likewise.
>
> * etc/NEWS: Document `shell-command-sentinel-function'.
> ---
>  etc/NEWS          | 7 +++++++
>  lisp/net/tramp.el | 2 +-
>  lisp/simple.el    | 8 +++++++-
>  3 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/etc/NEWS b/etc/NEWS
> index 0a9f197eaf8..ef4b0cce20f 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -4330,6 +4330,13 @@ return the output buffer name.  It takes precedenc=
e
> over
>  'shell-command-unique-output-buffer-p', 'shell-command-buffer-name', and
>  'shell-command-buffer-name-async'.
>
> ++++
> +** New variable 'shell-command-sentinel-function'.
> +This variable holds the process sentinel used for asynchronous shell
> +commands.  Lisp programs can let-bind it around a call to
> +'shell-command' to replace the sentinel entirely, allowing custom
> +handling of any process status.
> +
>  +++
>  ** 'make-vtable' can create an empty vtable.
>  It is now possible to create a vtable without data, by leaving the
> diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
> index f9abe4d6135..5ce65b614bb 100644
> --- a/lisp/net/tramp.el
> +++ b/lisp/net/tramp.el
> @@ -5746,7 +5746,7 @@ tramp-handle-shell-command
>                   ((not (eq major-mode 'shell-mode))
>                    (shell-mode)))
>                 (set-process-filter p #'comint-output-filter)
> -               (set-process-sentinel p #'shell-command-sentinel)
> +               (set-process-sentinel p shell-command-sentinel-function)
>                 (when error-file
>                   (add-function
>                    :after (process-sentinel p)
> diff --git a/lisp/simple.el b/lisp/simple.el
> index fea990c09d7..04a28053c8d 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -4808,7 +4808,7 @@ shell-command
>                  (setq-local revert-buffer-function
>                              (lambda (&rest _)
>                                (async-shell-command command buffer)))
> -                (set-process-sentinel proc #'shell-command-sentinel)
> +                (set-process-sentinel proc
> shell-command-sentinel-function)
>                 ;; Use the comint filter for proper handling of
>                 ;; carriage motion (see comint-inhibit-carriage-motion).
>                  (set-process-filter proc #'comint-output-filter)
> @@ -4950,6 +4950,12 @@ display-message-or-buffer
>                     (display-buffer (current-buffer) action frame))))))))
>
>
> +(defvar shell-command-sentinel-function #'shell-command-sentinel
> +  "Function used as the process sentinel for asynchronous shell commands=
.
> +The value is passed directly to `set-process-sentinel'.  Lisp programs
> +can let-bind this variable around a call to `shell-command' to replace
> +the sentinel entirely, allowing custom handling of any process status.")
> +
>  ;; We have a sentinel to prevent insertion of a termination message
>  ;; in the buffer itself, and to set the point in the buffer when
>  ;; `shell-command-dont-erase-buffer' is non-nil.
> --
> 2.52.0
>
>
So this is just a follow-up proposal based on the feedback from the
previous thread, integrating that feedback, in particular:

* I switched from using the exit hook to just making the entire
  shell-command sentinel configurable to packages.
* I mirrored those changes in tramp

I know you are hesitant to integrate any of this, and of course that
is fine, but I wanted to at least present those changes in their full
form before continuing.

--000000000000f84e6a064e803d14
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Thu, Apr 2, 2026 at 2:29=E2=80=AFPM &l=
t;<a href=3D"mailto:scmorris.dev@HIDDEN">scmorris.dev@HIDDEN</a>&gt; =
wrote:</div><div class=3D"gmail_quote gmail_quote_container"><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid=
 rgb(204,204,204);padding-left:1ex">From: &quot;S.C. Morris&quot; &lt;<a hr=
ef=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmorris.dev@HIDDEN=
om</a>&gt;<br>
<br>
* lisp/simple.el (shell-command-sentinel-function): New defvar,<br>
defaulting to `shell-command-sentinel&#39;, passed to<br>
`set-process-sentinel&#39; for asynchronous shell commands.=C2=A0 Lisp<br>
programs can let-bind it to replace the sentinel entirely.<br>
(shell-command): Use `shell-command-sentinel-function&#39; instead of<br>
the literal `#&#39;shell-command-sentinel&#39;.<br>
<br>
* lisp/net/tramp.el (tramp-handle-shell-command): Likewise.<br>
<br>
* etc/NEWS: Document `shell-command-sentinel-function&#39;.<br>
---<br>
=C2=A0etc/NEWS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 7 +++++++<br>
=C2=A0lisp/net/tramp.el | 2 +-<br>
=C2=A0lisp/simple.el=C2=A0 =C2=A0 | 8 +++++++-<br>
=C2=A03 files changed, 15 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/etc/NEWS b/etc/NEWS<br>
index 0a9f197eaf8..ef4b0cce20f 100644<br>
--- a/etc/NEWS<br>
+++ b/etc/NEWS<br>
@@ -4330,6 +4330,13 @@ return the output buffer name.=C2=A0 It takes preced=
ence over<br>
=C2=A0&#39;shell-command-unique-output-buffer-p&#39;, &#39;shell-command-bu=
ffer-name&#39;, and<br>
=C2=A0&#39;shell-command-buffer-name-async&#39;.<br>
<br>
++++<br>
+** New variable &#39;shell-command-sentinel-function&#39;.<br>
+This variable holds the process sentinel used for asynchronous shell<br>
+commands.=C2=A0 Lisp programs can let-bind it around a call to<br>
+&#39;shell-command&#39; to replace the sentinel entirely, allowing custom<=
br>
+handling of any process status.<br>
+<br>
=C2=A0+++<br>
=C2=A0** &#39;make-vtable&#39; can create an empty vtable.<br>
=C2=A0It is now possible to create a vtable without data, by leaving the<br=
>
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el<br>
index f9abe4d6135..5ce65b614bb 100644<br>
--- a/lisp/net/tramp.el<br>
+++ b/lisp/net/tramp.el<br>
@@ -5746,7 +5746,7 @@ tramp-handle-shell-command<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((not (eq ma=
jor-mode &#39;shell-mode))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(shell=
-mode)))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-process-filter=
 p #&#39;comint-output-filter)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(set-process-sentin=
el p #&#39;shell-command-sentinel)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(set-process-sentin=
el p shell-command-sentinel-function)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when error-file<br=
>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (add-functio=
n<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0:after=
 (process-sentinel p)<br>
diff --git a/lisp/simple.el b/lisp/simple.el<br>
index fea990c09d7..04a28053c8d 100644<br>
--- a/lisp/simple.el<br>
+++ b/lisp/simple.el<br>
@@ -4808,7 +4808,7 @@ shell-command<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq-local r=
evert-buffer-function<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(lambda (&amp;rest _)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(async-shell-command command buffer))=
)<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-process-senti=
nel proc #&#39;shell-command-sentinel)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-process-senti=
nel proc shell-command-sentinel-function)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Use the comint f=
ilter for proper handling of<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; carriage motion =
(see comint-inhibit-carriage-motion).<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(set-process-=
filter proc #&#39;comint-output-filter)<br>
@@ -4950,6 +4950,12 @@ display-message-or-buffer<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (disp=
lay-buffer (current-buffer) action frame))))))))<br>
<br>
<br>
+(defvar shell-command-sentinel-function #&#39;shell-command-sentinel<br>
+=C2=A0 &quot;Function used as the process sentinel for asynchronous shell =
commands.<br>
+The value is passed directly to `set-process-sentinel&#39;.=C2=A0 Lisp pro=
grams<br>
+can let-bind this variable around a call to `shell-command&#39; to replace=
<br>
+the sentinel entirely, allowing custom handling of any process status.&quo=
t;)<br>
+<br>
=C2=A0;; We have a sentinel to prevent insertion of a termination message<b=
r>
=C2=A0;; in the buffer itself, and to set the point in the buffer when<br>
=C2=A0;; `shell-command-dont-erase-buffer&#39; is non-nil.<br>
-- <br>
2.52.0<br>
<br></blockquote><div>=C2=A0</div><div>So this is just a follow-up proposal=
 based on the feedback from the<br>previous thread, integrating that feedba=
ck, in particular:<br><br>* I switched from using the exit hook to just mak=
ing the entire<br>=C2=A0 shell-command sentinel configurable to packages.<b=
r>* I mirrored those changes in tramp<br><br>I know you are hesitant to int=
egrate any of this, and of course that<br>is fine, but I wanted to at least=
 present those changes in their full<br>form before continuing.</div></div>=
</div>

--000000000000f84e6a064e803d14--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 2 Apr 2026 20:29:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 02 16:29:25 2026
Received: from localhost ([127.0.0.1]:47691 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w8OfM-0004FL-Hk
	for submit <at> debbugs.gnu.org; Thu, 02 Apr 2026 16:29:24 -0400
Received: from mail-oo1-xc2f.google.com ([2607:f8b0:4864:20::c2f]:56463)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <scmorris.dev@HIDDEN>)
 id 1w8OfK-0004FB-48
 for 80689 <at> debbugs.gnu.org; Thu, 02 Apr 2026 16:29:22 -0400
Received: by mail-oo1-xc2f.google.com with SMTP id
 006d021491bc7-67e02b821cfso704281eaf.0
 for <80689 <at> debbugs.gnu.org>; Thu, 02 Apr 2026 13:29:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1775161761; x=1775766561; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=6SPpYu7t1m24Lcce0g+O2scCjl9T/vIBSnY9mGIuySE=;
 b=iXHy0R5RiOpyb1j74KtnboET546aye75c8bapS/LY9ctgb1DPihamYTWl2GzlMXPUT
 TS252WPqWL/BSUOYyP3sdjL4/LBVePZHRwKlrrAWmCRi9KvGb3N4DrIac5zlRwV42y7+
 +VfFxBnU8usbdJS1JgAUwJE4kCxldkU2yzW5ekwva+XItLURmZ0M9LrirOKR10Zos5gm
 vKRHRAtmuYpguBwjSO9EIUSZtx3hErDA1ulcjtnjc4hcxRVM8NgneYcTjMSwynNF8LtX
 lDUxVhr9uiHJDEpCzsAuNKw+SSd9kKqwMns5L0pXBVBws+Pj/bwEnIlPE5X3cf4vfIU9
 96cA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1775161761; x=1775766561;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=6SPpYu7t1m24Lcce0g+O2scCjl9T/vIBSnY9mGIuySE=;
 b=gmmNYXH5I32hwQ1v9qtUV/pwLRb28rTolF7Q31HmBTGIbHC8jVKAoweyU/ie+pyu5V
 CHH16ZqujS18Xrw0ej2ladaKO2aimz2Nq5el80GRz7p4TWlrHV5TD6U1b77qbNQYkyes
 0NCLKgOeStlNyl/sXYuh/5QQywGac4yjzptR0y5fYL4MSeKO5ocOnWN+0i8fT0Fbvtun
 WVHz5W2y4DtpqjM+gz/XQpVRGeRWaMkbC0Vop4B2glHDU8h98RHLF0Rb8ZC/SFhxHUEz
 Wmaq2kD8ASgc169nOgPOkUBjaI4FBUl5LOw87w8S9BcB20LAUAa3O+HaYIaPgfJRsK5l
 cYSA==
X-Gm-Message-State: AOJu0Yx+gdomH+LZcpW/7iyvKksvatUzK/0hzTAs4yUypM1uik6wwlAG
 0lQ30h3oLW9kXhOpXeBOsSp8A5TOtfanC/X6qo/HjMF9VOL+7Nr3IIUV36Fr0G6I
X-Gm-Gg: ATEYQzy1c8Yp0bWzfd6NG9Vjly/3mn8RuRQ3dJMr2JyGplNx8BUJqVlV9PSiSWDEpKS
 aFIl0vNIfNMLybJYCAiuLxiNUCgnxwAbcBYfu/bSIBM8499PuiFRh9Aro0tl67AugO3tKh/yee+
 4Oa7zEiUYo5EQfTaY7QPFRwKV5fq4raie9NTPIN27juGY3jlMRWvdY83ltFxjZroWPsF0ijaw1A
 0croa6+yphTlnseIteFiEecqSbmAAFD/J0YVewZpwBYi797M0edjb2wdZDd3TDaxRj6hKN/GScG
 EReSZpzXSZKmd9pEFvHM9IlJfSN8xKIFY+CiCTjQ3XJVB7qeQlmcBJVvAYOdR96R6ZT/b6J+GT5
 XNq3OeAQkkE8widh4AwMCb/kOprDfJb9rRlIqnPyt/a4pI1nG6njUKoVj/M7mZfzyYgXcoRw8up
 ut2esmmpaLf9RZqMwfnzmt+nKg
X-Received: by 2002:a05:6820:6ac1:b0:681:a608:5e94 with SMTP id
 006d021491bc7-6821d83c7b6mr386769eaf.10.1775161760543; 
 Thu, 02 Apr 2026 13:29:20 -0700 (PDT)
Received: from envy.tail20243e.ts.net ([2601:282:1d00:ad10::7451])
 by smtp.gmail.com with ESMTPSA id
 006d021491bc7-680a267c4ebsm2514832eaf.0.2026.04.02.13.29.19
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Apr 2026 13:29:20 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: 80689 <at> debbugs.gnu.org
Subject: [PATCH 2/2] add shell-command-sentinel-function
Date: Thu,  2 Apr 2026 14:29:19 -0600
Message-ID: <9767dd98614676dc5341d6a2e8e7c95affbf744a.1775143646.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <87y0j7gnpr.fsf@HIDDEN>
References: <87y0j7gnpr.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80689
Cc: "S.C. Morris" <scmorris.dev@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

From: "S.C. Morris" <scmorris.dev@HIDDEN>

* lisp/simple.el (shell-command-sentinel-function): New defvar,
defaulting to `shell-command-sentinel', passed to
`set-process-sentinel' for asynchronous shell commands.  Lisp
programs can let-bind it to replace the sentinel entirely.
(shell-command): Use `shell-command-sentinel-function' instead of
the literal `#'shell-command-sentinel'.

* lisp/net/tramp.el (tramp-handle-shell-command): Likewise.

* etc/NEWS: Document `shell-command-sentinel-function'.
---
 etc/NEWS          | 7 +++++++
 lisp/net/tramp.el | 2 +-
 lisp/simple.el    | 8 +++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 0a9f197eaf8..ef4b0cce20f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4330,6 +4330,13 @@ return the output buffer name.  It takes precedence over
 'shell-command-unique-output-buffer-p', 'shell-command-buffer-name', and
 'shell-command-buffer-name-async'.
 
++++
+** New variable 'shell-command-sentinel-function'.
+This variable holds the process sentinel used for asynchronous shell
+commands.  Lisp programs can let-bind it around a call to
+'shell-command' to replace the sentinel entirely, allowing custom
+handling of any process status.
+
 +++
 ** 'make-vtable' can create an empty vtable.
 It is now possible to create a vtable without data, by leaving the
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index f9abe4d6135..5ce65b614bb 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5746,7 +5746,7 @@ tramp-handle-shell-command
                  ((not (eq major-mode 'shell-mode))
                   (shell-mode)))
 		(set-process-filter p #'comint-output-filter)
-		(set-process-sentinel p #'shell-command-sentinel)
+		(set-process-sentinel p shell-command-sentinel-function)
 		(when error-file
 		  (add-function
 		   :after (process-sentinel p)
diff --git a/lisp/simple.el b/lisp/simple.el
index fea990c09d7..04a28053c8d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4808,7 +4808,7 @@ shell-command
                 (setq-local revert-buffer-function
                             (lambda (&rest _)
                               (async-shell-command command buffer)))
-                (set-process-sentinel proc #'shell-command-sentinel)
+                (set-process-sentinel proc shell-command-sentinel-function)
 		;; Use the comint filter for proper handling of
 		;; carriage motion (see comint-inhibit-carriage-motion).
                 (set-process-filter proc #'comint-output-filter)
@@ -4950,6 +4950,12 @@ display-message-or-buffer
 		    (display-buffer (current-buffer) action frame))))))))
 
 
+(defvar shell-command-sentinel-function #'shell-command-sentinel
+  "Function used as the process sentinel for asynchronous shell commands.
+The value is passed directly to `set-process-sentinel'.  Lisp programs
+can let-bind this variable around a call to `shell-command' to replace
+the sentinel entirely, allowing custom handling of any process status.")
+
 ;; We have a sentinel to prevent insertion of a termination message
 ;; in the buffer itself, and to set the point in the buffer when
 ;; `shell-command-dont-erase-buffer' is non-nil.
-- 
2.52.0





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 1 Apr 2026 07:10:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 01 03:10:52 2026
Received: from localhost ([127.0.0.1]:51278 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w7pj2-0003q7-8x
	for submit <at> debbugs.gnu.org; Wed, 01 Apr 2026 03:10:52 -0400
Received: from mout.gmx.net ([212.227.17.22]:53911)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael.albinus@HIDDEN>)
 id 1w7piy-0003pF-K1
 for 80689 <at> debbugs.gnu.org; Wed, 01 Apr 2026 03:10:49 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de;
 s=s31663417; t=1775027442; x=1775632242; i=michael.albinus@HIDDEN;
 bh=OrHGKsKlWAGvoqK8km8FucjvtWR3QIdmtDo+gsHVgho=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=o8JFijXELxF5fbflBk9OagIm5YSO9bBQZ4l4COwHbSNZGt4aWH02AkJz3IAP7ZiP
 mGwezin8U+2EOuoS8quJZSEbsCbR3ap7FyFa+nD9mlUr6fOI2NNQZr4O3WgO1Mzcc
 5uym4bPo378oUReZz/xv0aBCKdrPCn3tHDjk+lY4V+/usQfQXHyiZZ8b2GsQ9V8K0
 j4fHcS1/opV+2XKj8KW5guN92sURPWx3bXvT97zTYrnl9UQ3DIN8UmFP9siy+eSS/
 bTQ0MkVyXSGg/6kDaBVM0s5Lu0EKC2g9Ul9sjnfljOsOLNHLAYGv6W/CidqX0SdSh
 +za+tNWDvkSESHLWqw==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from client.hidden.invalid by mail.gmx.net (mrgmx104
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MhlGq-1vcukU0Ro8-00bJDz; Wed, 01
 Apr 2026 09:10:42 +0200
From: Michael Albinus <michael.albinus@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#80689: [PATCH 2/2] add shell-command-finished-hook
In-Reply-To: <86fr5foo7m.fsf@HIDDEN>
References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
 <ef6669abce4d126d4c55dcdba0246558c826c13d.1774821272.git.scmorris.dev@HIDDEN>
 <865x6dqp9z.fsf@HIDDEN>
 <CAEkeNzhzd=szHKx5waOsXw8EE0pp8JQR6EoWhHo-v0DvvGYWtA@HIDDEN>
 <86fr5foo7m.fsf@HIDDEN>
Date: Wed, 01 Apr 2026 09:10:40 +0200
Message-ID: <87y0j7gnpr.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:i3qDYJ452w3ScthDnf91XeYFag43AwZm5nAt8RoAdjoyprso2PI
 tnHiVt59gH/aI8ylBuwSMJv+k1uGKQ2DTa3GrrbZzf3SOWQRo/dh/1pMCn4E6X2ZDXKEN+m
 7ULC4NFRV3iUycnnv+0InWmMkQ/uv+0TwRe+sog8sf0g44x4Z3gahSlR3LJu2Fe3WxsH61q
 WjEnDuE9RJ5lCXYCBltgA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:lBdaeARLAq4=;ggvjVzfyR38xLSHj7dfQwcocfZf
 O4ZkWiFdv1TQ2WEOEkeR75qLI5AvESfmRpAHX4WrEBga31ybmExvmM61XxKtkBC74iGdBgfX5
 XZ7Pmxd6+sRBJTLYDlL/PvuEMws8Z8x9/xmoEdqtoF7zbThPL4nHC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L10iwRI2VEM6hJbmO
 0kaRFa8DUTw4U/a8zc8xiiqogDGMPrjqQ==
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Eli Zaretskii writes: Hi,
 > I'm beginning to think that shell-command
 is not the right tool for > such flexible jobs. Isn't it easier to just write
 your own command, > and then do all of that in the sentinel that you write?
 > [...] Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.7 RCVD_IN_DNSWL_LOW      RBL: Sender listed at https://www.dnswl.org/,
 low trust [212.227.17.22 listed in list.dnswl.org]
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (michael.albinus[at]gmx.de)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [212.227.17.22 listed in wl.mailspike.net]
 1.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [212.227.17.22 listed in bl.score.senderscore.com]
 1.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [212.227.17.22 listed in sa-trusted.bondedsender.org]
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org, Samuel Morris <scmorris.dev@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 Sean Whitton <spwhitton@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

Hi,

> I'm beginning to think that shell-command is not the right tool for
> such flexible jobs.  Isn't it easier to just write your own command,
> and then do all of that in the sentinel that you write?
>
> But I guess we could also let users and Lisp programs customize the
> sentinel of shell-command.  Sean and Stefan, WDYT?

FTR, any change in shell-command shall be mirrored in Tramp's
tramp-handle-shell-command. Whether this is an argument against writing
a new command I don't know.

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 31 Mar 2026 19:27:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 31 15:27:21 2026
Received: from localhost ([127.0.0.1]:42550 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w7ekC-0007r2-Tz
	for submit <at> debbugs.gnu.org; Tue, 31 Mar 2026 15:27:21 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:4463)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1w7ekB-0007qc-5m
 for 80689 <at> debbugs.gnu.org; Tue, 31 Mar 2026 15:27:19 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 94313100146;
 Tue, 31 Mar 2026 15:27:13 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1774985232;
 bh=ZbFML0Nt6Udr+1KMFlSfjVuy7HYC5Xvivu45q68HxwA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=bHCMOZGDZEMLsJ2x0TxjLPuqbmm+70R4OJXlN4nSd3tSUQleQRFe4OUtH5mZXibQ2
 6uOS1rECTr1LPmBbdI0EJzpdjnljfiB0tVC8xjY1S6E37BRR8pHQqlfi9iyp6yaomf
 TEyvgcsvsQJ4MzF1WPvq69Vx40TMLzzB4nt14ehNq3kAi46kvXs7ELa0I8avg0g+aq
 j26DVK4/61n3qwxPkbUpRirILQYKvX6fQbOiPwj2qmGSJhuF8QkXgh0cbUlGDqATy7
 qJY2YaiuquLFAbqM3uW5cjWTGiMU9MKBhTLvn6QAdifPQuvbJ2xms9L7OJ8YueJerk
 u2SlqaBcw4Blg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B90A810002E;
 Tue, 31 Mar 2026 15:27:12 -0400 (EDT)
Received: from alfajor (unknown [204.48.91.210])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6172D120BB4;
 Tue, 31 Mar 2026 15:27:12 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#80689: [PATCH 2/2] add shell-command-finished-hook
In-Reply-To: <86fr5foo7m.fsf@HIDDEN>
Message-ID: <jwv8qb7kdu8.fsf-monnier+emacs@HIDDEN>
References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
 <ef6669abce4d126d4c55dcdba0246558c826c13d.1774821272.git.scmorris.dev@HIDDEN>
 <865x6dqp9z.fsf@HIDDEN>
 <CAEkeNzhzd=szHKx5waOsXw8EE0pp8JQR6EoWhHo-v0DvvGYWtA@HIDDEN>
 <86fr5foo7m.fsf@HIDDEN>
Date: Tue, 31 Mar 2026 15:27:11 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.000 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -0.3 (/)
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org, Samuel Morris <scmorris.dev@HIDDEN>,
 Sean Whitton <spwhitton@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> I'm beginning to think that shell-command is not the right tool for
> such flexible jobs.  Isn't it easier to just write your own command,
> and then do all of that in the sentinel that you write?
> But I guess we could also let users and Lisp programs customize the
> sentinel of shell-command.  Sean and Stefan, WDYT?

I don't use asynchronous `shell-command` enough (and don't know people
who do) to have a clear opinion.

But currently, it's not easy to write your own command that does the
same as `shell-command` except for some change in the sentinel.
So we should at least change `shell-command` to return the process object
when the command is run asynchronously.

Comment about the original patch: the hook's name should end in
`-functions` rather than `-hook` because it's not a "normal hook".


=== Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 31 Mar 2026 18:21:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 31 14:21:17 2026
Received: from localhost ([127.0.0.1]:41902 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w7diE-0002D3-5T
	for submit <at> debbugs.gnu.org; Tue, 31 Mar 2026 14:21:16 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:53258)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1w7dhh-00026a-3C
 for 80689 <at> debbugs.gnu.org; Tue, 31 Mar 2026 14:20:41 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1w7dha-0005ST-GC; Tue, 31 Mar 2026 14:20:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=EVvloGjXROVq/lzo7WfXyc+CACJVqLMhxVDbU5WK5aM=; b=PlWMJEFQbKjLg8kOcVPB
 0piIxoVpC9qDvWU+SFntjzzSc3jEiSVDkB2lCjbfXBTZJziQeQsPayXw6wBkBRlhar6adPVTiql8Y
 clfNHKvrZmMoqa1Rqfcw2PTZpgiKvgfcdtGwjUNO2v3wWaSsjfg1URbSJxd2R7cUa246sbkVGnDJC
 jOOrIZM16oU31eEc2/VVazvXlOLBCw0sYLVbOC6T57piJ1j0+gQYNPbDbg4vAdVjbXFkePzchymNU
 FgTiVKv/Y6DzY5G2vXy5RfFxl8Akvqv3TH3vXynbsl8qLuOPp0v9dw9Is0irjMMBJqAmWEB+BNC7+
 oa6rvJuTfLIQMQ==;
Date: Tue, 31 Mar 2026 21:20:29 +0300
Message-Id: <86fr5foo7m.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Samuel Morris <scmorris.dev@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>,
 Sean Whitton <spwhitton@HIDDEN>
In-Reply-To: <CAEkeNzhzd=szHKx5waOsXw8EE0pp8JQR6EoWhHo-v0DvvGYWtA@HIDDEN>
 (message from Samuel Morris on Tue, 31 Mar 2026 11:16:22 -0600)
Subject: Re: bug#80689: [PATCH 2/2] add shell-command-finished-hook
References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
 <ef6669abce4d126d4c55dcdba0246558c826c13d.1774821272.git.scmorris.dev@HIDDEN>
 <865x6dqp9z.fsf@HIDDEN>
 <CAEkeNzhzd=szHKx5waOsXw8EE0pp8JQR6EoWhHo-v0DvvGYWtA@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Samuel Morris <scmorris.dev@HIDDEN>
> Date: Tue, 31 Mar 2026 11:16:22 -0600
> Cc: 80689 <at> debbugs.gnu.org
> 
>  > This hook is run by 'shell-command-sentinel' when an asynchronous shell
>  > command process exits or is signalled.  Each function is called with two
>  > arguments: PROCESS and SIGNAL.
> 
>  Thanks, but could you please describe the rationale and perhaps
>  describe a couple of use cases where such a hook could needed?
> 
> Yes, of course. For my immediate use-case, I have emacs trigger a
> desktop notification when an asynchronous process completes, and
> display the buffer in a configurable way, in particular, resetting
> POINT to the beginning of the buffer, and setting the buffer to text
> mode when the inferior process dies so I’m not trying to signal a dead
> process.
> 
> But I was really not thinking this through carefully enough. What if I
> want to process more than just the sighup signal, or override more
> behavior in shell-command-sentinel, or do things differently per async
> shell buffer? What I really want is a customizable sentinel, while
> still avoiding rewriting all of shell-command to point to my
> version. So something like this in shell-command:
> 
> ;; before 
> (set-process-sentinel proc #'shell-command-sentinel)
> ;; after 
> (set-process-sentinel proc shell-command-sentinel-function)
> 
> Where shell-command-sentinel-function points to shell-command-sentinel
> by default. That way I can start adding full, programmatic two-way
> communication between emacs and the subprocess. If it is okay with
> you, I would like to resubmit with that change. What are your
> thoughts? And thank you very much for taking the time to look at this.

I'm beginning to think that shell-command is not the right tool for
such flexible jobs.  Isn't it easier to just write your own command,
and then do all of that in the sentinel that you write?

But I guess we could also let users and Lisp programs customize the
sentinel of shell-command.  Sean and Stefan, WDYT?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 31 Mar 2026 17:16:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 31 13:16:42 2026
Received: from localhost ([127.0.0.1]:40751 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w7chk-0002oR-9n
	for submit <at> debbugs.gnu.org; Tue, 31 Mar 2026 13:16:42 -0400
Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]:59657)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <scmorris.dev@HIDDEN>)
 id 1w7chf-0002nX-Cn
 for 80689 <at> debbugs.gnu.org; Tue, 31 Mar 2026 13:16:37 -0400
Received: by mail-ej1-x62e.google.com with SMTP id
 a640c23a62f3a-b982d56dac4so1017772566b.3
 for <80689 <at> debbugs.gnu.org>; Tue, 31 Mar 2026 10:16:35 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1774977394; cv=none;
 d=google.com; s=arc-20240605;
 b=SiBUqg/ChWWyeK3aAapRBgOgz3sEjmUol+/Zh1jmWkqThRwGCOGn1MVefwyk6xFkgU
 cakSVuH8n53EjA097cTXDNtYrDS0/edZaDu3r7mKNVhSLIoetN9hGRj86zdUwv5Zzkwl
 FBzetXqaNI0xrrUtkCQr59fCc38UoTgaE1qeZHPKyrojeELdQuFv0mZ3a63o8Y4dtE1J
 IGNYAUytux/olFAbYhdjm/Vp5guaF1CLX/g2oib3WPFAUxd+TXrVrGPihBUFAeDeD3Bw
 xMT2tIP+GN0gwwHJvTCNlPIAOdqCkJEqVZ0ZtlIxGxyqyWuzfXLMq8QdWr+736TmM1+y
 yF+Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
 s=arc-20240605; 
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:dkim-signature;
 bh=tj7uWdg9mrt0kPda013qfZG8uNz9Ms1IVywQTaUZ6Q8=;
 fh=+VqE+SY9UbHa79dJOLzN23/cRX7FNiJYTrK0sX0HkaI=;
 b=bzaz9z/9RZvJCxxkw0HFfytuGmoCz4d7eF4A4QpdKhCj8kNv1Uu4GgRRPB9PutsJJ/
 tbZceicyLp4KT4uDUxkIiLea6Fr/T73fKEia6T7awedxestScbKgmcSwa1Wu9Ytbv4uT
 OYZKFxiiGYDgVBHeWDtcTVEdHyZBmuxLYLV9/2qOp8ZYaDkEb3VeahCt/oASH72Xq2Ks
 NS2BM9e4SMTBJhoJpJSpclhSO5ymsmDWR00eKaACyHhCfIbxA+hjgLDH7ngrA8YCF4OS
 fuu9H1EW7VtfS+qfM9mAzi2rgJUlj3T5sNKzNxjE6zaKvXW3JbomuRpCbeHC9D1+U+5S
 a69w==; darn=debbugs.gnu.org
ARC-Authentication-Results: i=1; mx.google.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1774977394; x=1775582194; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=tj7uWdg9mrt0kPda013qfZG8uNz9Ms1IVywQTaUZ6Q8=;
 b=STVNfU+1G5GlxSri5MEbrxmz/hh58FBgR6iVOE20c/Guf7pORlRZJbvDrzeFAdGL3C
 UD15Q+nMmv4MriJx+ghWs69KHi9HsO4/Sj7OS3Bicpzk0cuNK2Hvi0xtgbi4V0eNmM+w
 ieLvyo+zYXZZllaY9T7UHoV3PK57JlklFtEMQThvAKoHSaxSJi/UyP2eI38i9cC7n7Gj
 WGGLDv1JsgBl2aN/Rqjl94uxIZboKVKQPmFZOPARpwuVEv+NTHOYlVOYnmXnHY7x1D3c
 ppevwETCawssr8z9dmffogV8DpXXstQAOe6HHj6O+znGTVWcyVrO5jGsFFKcGxVVNWvs
 kJFg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1774977394; x=1775582194;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=tj7uWdg9mrt0kPda013qfZG8uNz9Ms1IVywQTaUZ6Q8=;
 b=CueFQVx0le9y9/3dc8p1jGK8dhhJ+hUYBzgELoF8wDkb84M4YqukGf9n/7mc85Ax2D
 9ZtGZD7KjA3CQPcYZnBJeXF+nUIQRhUL4QF9RUX4PEbgJDMxaxPZ7OjODqn8MTC4TFf0
 gfmMqXSt6Mt8OYzfu/cdt+HCTk6LbP1xOB22nI3h4mI4PPeztjyHPmu+ldOu9xAyLwYu
 mrvyddtljH0JFqs0FkvHE4PpgbeVDKPPgqlmlBovDXgT1tRjgpxNXp4w8FkiaIhedrSs
 VtYDt9GH8fdbKIm56alQN0xPuueO7czab+bkyjc4MwYtHgTi6ghr+rWegJG0JYD9M/OP
 go8w==
X-Gm-Message-State: AOJu0YzjFMoMyu4fGDgrnmc5WMoEgFPub631O2HhaS7P88Yj8KPBXiYr
 jtsMpSHnttq+I1zWLwh6yYDcOVtMiIHkJlxpPp+PEUvRuGO6tUUQ3U1WflyjRG3h/qOwINwrGP/
 zu1a0Bjd7nu5Xk/lz4byhgfxz5g6idsQ=
X-Gm-Gg: ATEYQzwtD153XeHkQp75zBENMGKDM5rwgux0nhLttkdneoo0vYnezSENMHaym4t6x5o
 OZwwNetfKUN5sjYtpz920+rHjAuxqnk4c23D/s/v9B2cNiwC9GOGG/HvlKQR+D9JWHCj/sQIbCe
 /xrdEAhgTbWN4xR2tHfs9oHLN5bcYt+DrTUX1s6Z5cwxYKhw1SPQXyrC0PbYhc5F1BtVRNKQW6E
 DvgKr93G/gpWqCv+Xk1EIC2/0aMouVXarnpXYYVVOTwOLnu4DEGPhU2F5Ggb7/JwCvuXbteXSak
 qoJu0vs9
X-Received: by 2002:a17:907:a604:b0:b93:cae3:5834 with SMTP id
 a640c23a62f3a-b9c138d3ecbmr35047966b.13.1774977393748; Tue, 31 Mar 2026
 10:16:33 -0700 (PDT)
MIME-Version: 1.0
References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
 <ef6669abce4d126d4c55dcdba0246558c826c13d.1774821272.git.scmorris.dev@HIDDEN>
 <865x6dqp9z.fsf@HIDDEN>
In-Reply-To: <865x6dqp9z.fsf@HIDDEN>
From: Samuel Morris <scmorris.dev@HIDDEN>
Date: Tue, 31 Mar 2026 11:16:22 -0600
X-Gm-Features: AQROBzDzi6NCwsBgLfYkD9NRHYg8Y_wJEl-mcuj2H1GOIithdYjc1OhzwCtGJwU
Message-ID: <CAEkeNzhzd=szHKx5waOsXw8EE0pp8JQR6EoWhHo-v0DvvGYWtA@HIDDEN>
Subject: Re: bug#80689: [PATCH 2/2] add shell-command-finished-hook
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000009eec1064e552152"
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

--00000000000009eec1064e552152
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Mar 30, 2026 at 10:02=E2=80=AFAM Eli Zaretskii <eliz@HIDDEN> wrote=
:

> > Cc: "S.C. Morris" <scmorris.dev@HIDDEN>
> > From: scmorris.dev@HIDDEN
> > Date: Sun, 29 Mar 2026 16:48:40 -0600
> >
> > From: "S.C. Morris" <scmorris.dev@HIDDEN>
> >
> > This hook is run by 'shell-command-sentinel' when an asynchronous shell
> > command process exits or is signalled.  Each function is called with tw=
o
> > arguments: PROCESS and SIGNAL.
>
> Thanks, but could you please describe the rationale and perhaps
> describe a couple of use cases where such a hook could needed?
>

Yes, of course. For my immediate use-case, I have emacs trigger a
desktop notification when an asynchronous process completes, and
display the buffer in a configurable way, in particular, resetting
POINT to the beginning of the buffer, and setting the buffer to text
mode when the inferior process dies so I=E2=80=99m not trying to signal a d=
ead
process.

But I was really not thinking this through carefully enough. What if I
want to process more than just the sighup signal, or override more
behavior in shell-command-sentinel, or do things differently per async
shell buffer? What I really want is a customizable sentinel, while
still avoiding rewriting all of shell-command to point to my
version. So something like this in shell-command:

;; before
(set-process-sentinel proc #'shell-command-sentinel)
;; after
(set-process-sentinel proc shell-command-sentinel-function)

Where shell-command-sentinel-function points to shell-command-sentinel
by default. That way I can start adding full, programmatic two-way
communication between emacs and the subprocess. If it is okay with
you, I would like to resubmit with that change. What are your
thoughts? And thank you very much for taking the time to look at this.

--00000000000009eec1064e552152
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Mon, Mar 30, 2026 at 10:02=E2=80=AFAM =
Eli Zaretskii &lt;<a href=3D"mailto:eliz@HIDDEN">eliz@HIDDEN</a>&gt; wrot=
e:</div><div class=3D"gmail_quote gmail_quote_container"><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex">&gt; Cc: &quot;S.C. Morris&quot; &lt;<a hr=
ef=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmorris.dev@HIDDEN=
om</a>&gt;<br>
&gt; From: <a href=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmo=
rris.dev@HIDDEN</a><br>
&gt; Date: Sun, 29 Mar 2026 16:48:40 -0600<br>
&gt; <br>
&gt; From: &quot;S.C. Morris&quot; &lt;<a href=3D"mailto:scmorris.dev@gmail=
.com" target=3D"_blank">scmorris.dev@HIDDEN</a>&gt;<br>
&gt; <br>
&gt; This hook is run by &#39;shell-command-sentinel&#39; when an asynchron=
ous shell<br>
&gt; command process exits or is signalled.=C2=A0 Each function is called w=
ith two<br>
&gt; arguments: PROCESS and SIGNAL.<br>
<br>
Thanks, but could you please describe the rationale and perhaps<br>
describe a couple of use cases where such a hook could needed?<br></blockqu=
ote><div><br></div><div>Yes, of course. For my immediate use-case, I have e=
macs trigger a<br>desktop notification when an asynchronous process complet=
es, and<br>display the buffer in a configurable way, in particular, resetti=
ng<br>POINT to the beginning of the buffer, and setting the buffer to text<=
br>mode when the inferior process dies so I=E2=80=99m not trying to signal =
a dead<br>process.<br><br>But I was really not thinking this through carefu=
lly enough. What if I<br>want to process more than just the sighup signal, =
or override more<br>behavior in shell-command-sentinel, or do things differ=
ently per async<br>shell buffer? What I really want is a customizable senti=
nel, while<br>still avoiding rewriting all of shell-command to point to my<=
br>version. So something like this in shell-command:<br><br>;; before=C2=A0=
</div><div>(set-process-sentinel proc #&#39;shell-command-sentinel)<br>;; a=
fter=C2=A0</div><div>(set-process-sentinel proc shell-command-sentinel-func=
tion)<br><br>Where shell-command-sentinel-function points to shell-command-=
sentinel<br>by default. That way I can start adding full, programmatic two-=
way<br>communication between emacs and the subprocess. If it is okay with<b=
r>you, I would like to resubmit with that change. What are your<br>thoughts=
? And thank you very much for taking the time to look at this.<br>=C2=A0</d=
iv></div></div>

--00000000000009eec1064e552152--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at 80689 <at> debbugs.gnu.org:


Received: (at 80689) by debbugs.gnu.org; 30 Mar 2026 16:02:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 30 12:02:30 2026
Received: from localhost ([127.0.0.1]:52765 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w7F4P-0006Tv-38
	for submit <at> debbugs.gnu.org; Mon, 30 Mar 2026 12:02:29 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:39744)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1w7F4M-0006SB-1h
 for 80689 <at> debbugs.gnu.org; Mon, 30 Mar 2026 12:02:27 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1w7F4G-0003m0-DK; Mon, 30 Mar 2026 12:02:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=CKL5IaQ5QgZSjeJ7Ia9mCG2XWRxKNsrCAVxn1GX+2jk=; b=TyqZE4i1SFYX
 5rjLp9pgRA8p9UnHkwmwcHSN23lwgk1K8VZSddLOOWPjoXru9a1P51HIn2Owg6x9qb7HfFIZTKV4/
 CqQPlyYSAMCCpDDKigL03qE1i5jnfZj83y3K5lTHGuLgdtR1Nze08LVUi5eDCNDjQPvwnaTKrbctz
 SpfWiHghKWgwOOYUNfEoT4jqjCXOwZuk9Y7O/0TZaA2OKIWrcif2N8fI+nIPPpGtrF60ccUoxcq6i
 TP9jzhWko+936yF2a3QjbvHW8yOw3ai/XzMvtWVvxJcx7xe8Ti2CA+gSsGYX9e5YUdq8i74fnvd14
 0XYP7gF8Ujin/hmBJYZ6Zw==;
Date: Mon, 30 Mar 2026 19:02:16 +0300
Message-Id: <865x6dqp9z.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: scmorris.dev@HIDDEN
In-Reply-To: <ef6669abce4d126d4c55dcdba0246558c826c13d.1774821272.git.scmorris.dev@HIDDEN>
Subject: Re: bug#80689: [PATCH 2/2] add shell-command-finished-hook
References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
 <ef6669abce4d126d4c55dcdba0246558c826c13d.1774821272.git.scmorris.dev@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80689
Cc: 80689 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: "S.C. Morris" <scmorris.dev@HIDDEN>
> From: scmorris.dev@HIDDEN
> Date: Sun, 29 Mar 2026 16:48:40 -0600
> 
> From: "S.C. Morris" <scmorris.dev@HIDDEN>
> 
> This hook is run by 'shell-command-sentinel' when an asynchronous shell
> command process exits or is signalled.  Each function is called with two
> arguments: PROCESS and SIGNAL.

Thanks, but could you please describe the rationale and perhaps
describe a couple of use cases where such a hook could needed?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 29 Mar 2026 22:48:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 29 18:48:57 2026
Received: from localhost ([127.0.0.1]:39177 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1w6ywD-0007Xj-2z
	for submit <at> debbugs.gnu.org; Sun, 29 Mar 2026 18:48:57 -0400
Received: from lists.gnu.org ([2001:470:142::17]:54956)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <scmorris.dev@HIDDEN>)
 id 1w6yw9-0007Wx-8k
 for submit <at> debbugs.gnu.org; Sun, 29 Mar 2026 18:48:53 -0400
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 <scmorris.dev@HIDDEN>)
 id 1w6yw3-0004H6-Td
 for bug-gnu-emacs@HIDDEN; Sun, 29 Mar 2026 18:48:47 -0400
Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <scmorris.dev@HIDDEN>)
 id 1w6yw2-0002W1-AK
 for bug-gnu-emacs@HIDDEN; Sun, 29 Mar 2026 18:48:47 -0400
Received: by mail-ot1-x330.google.com with SMTP id
 46e09a7af769-7d4c12ff3d5so3790221a34.2
 for <bug-gnu-emacs@HIDDEN>; Sun, 29 Mar 2026 15:48:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20251104; t=1774824524; x=1775429324; darn=gnu.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=XYiNy+CwgkbMTnAkmzSb3mRdcWfHYZG9ZyuMSdAfmfk=;
 b=HoVoTm6RdSTYc2RkA+e7v69v/P07A0NZjOiZikyEhb0gozioU5LOBbLdFXuSBcVLVI
 e6GIIu/vM6KHBCDHWSr7WqTHOABHpn6wt4gzHpLCh2xHs6KRCqSYJA6e5uul/Qg27pQn
 jn5WKr7JlBUikE4wf7lPO/Z8EHoW1M5Fxujxj7lZl9EqMI4Q0+b1GCeJPPLZbHbKXT0g
 HDb+g+mNXFBx2mPCKGKrmf/q8ktW2m8YqXoD/V9GBZQOSyOIxhfGvVuNFuMYxq8D2kym
 TJkEkQS7g1+t029V8iTAEZ5KxzVfVSao8j7wKw2wUTVucDk0tT0TqFSHhJ4d9wgpF84x
 433g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20251104; t=1774824524; x=1775429324;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=XYiNy+CwgkbMTnAkmzSb3mRdcWfHYZG9ZyuMSdAfmfk=;
 b=FGTh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774824524384; 
 Sun, 29 Mar 2026 15:48:44 -0700 (PDT)
Received: from envy.tail20243e.ts.net ([209.133.116.38])
 by smtp.gmail.com with ESMTPSA id
 46e09a7af769-7da0a7b62dfsm4845141a34.16.2026.03.29.15.48.42
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 29 Mar 2026 15:48:43 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH 2/2] add shell-command-finished-hook
Date: Sun, 29 Mar 2026 16:48:40 -0600
Message-ID: <ef6669abce4d126d4c55dcdba0246558c826c13d.1774821272.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2607:f8b0:4864:20::330;
 envelope-from=scmorris.dev@HIDDEN; helo=mail-ot1-x330.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: From: "S.C. Morris" This hook is run by
 'shell-command-sentinel'
 when an asynchronous shell command process exits or is signalled. Each
 function
 is called with two arguments: PROCESS and SIGNAL. * lisp/simple.el
 (shell-command-finished-hook):
 New defvar. (shell-command-sentinel): Run it. * etc/NEWS: Document it. ---
 etc/NEWS | 5 +++++ lisp/simple.el | 7 ++++++- 2 files changed, 11 insertions(
 [...] Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (scmorris.dev[at]gmail.com)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 1.0 FORGED_GMAIL_RCVD      'From' gmail.com does not match 'Received'
 headers
X-Debbugs-Envelope-To: submit
Cc: "S.C. Morris" <scmorris.dev@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

From: "S.C. Morris" <scmorris.dev@HIDDEN>

This hook is run by 'shell-command-sentinel' when an asynchronous shell
command process exits or is signalled.  Each function is called with two
arguments: PROCESS and SIGNAL.

* lisp/simple.el (shell-command-finished-hook): New defvar.
(shell-command-sentinel): Run it.
* etc/NEWS: Document it.
---
 etc/NEWS       | 5 +++++
 lisp/simple.el | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index cd20ea90b3a..9de62ccf481 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4324,6 +4324,11 @@ If non-nil, this function is called with the command string and should
 return the output buffer name, overriding 'shell-command-buffer-name'
 and 'shell-command-buffer-name-async'.
 
++++
+** New hook 'shell-command-finished-hook'.
+This hook is run when an asynchronous shell command process exits or is
+signalled.  Each function is called with two arguments: PROCESS and SIGNAL.
+
 +++
 ** 'make-vtable' can create an empty vtable.
 It is now possible to create a vtable without data, by leaving the
diff --git a/lisp/simple.el b/lisp/simple.el
index 44d9ff50c6f..35669b0c267 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4932,6 +4932,10 @@ display-message-or-buffer
 		    (display-buffer (current-buffer) action frame))))))))
 
 
+(defvar shell-command-finished-hook nil
+  "Hook run when an asynchronous shell command process exits or is signalled.
+Each function is called with two arguments: PROCESS and SIGNAL.")
+
 ;; We have a sentinel to prevent insertion of a termination message
 ;; in the buffer itself, and to set the point in the buffer when
 ;; `shell-command-dont-erase-buffer' is non-nil.
@@ -4943,7 +4947,8 @@ shell-command-sentinel
     (message "%s: %s."
              (car (cdr (cdr (or (process-get process 'remote-command)
                                 (process-command process)))))
-             (substring signal 0 -1))))
+             (substring signal 0 -1))
+    (run-hook-with-args 'shell-command-finished-hook process signal)))
 
 (defun shell-command-on-region (start end command
 				      &optional output-buffer replace
-- 
2.52.0





Acknowledgement sent to scmorris.dev@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#80689; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 9 Apr 2026 06:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.