Received: (at 80688) by debbugs.gnu.org; 7 Apr 2026 23:06:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 19:06:26 2026
Received: from localhost ([127.0.0.1]:43655 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wAFV1-00088T-F1
for submit <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:06:25 -0400
Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:57406)
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 1wAFUr-00086o-73
for 80688 <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:06:14 -0400
Received: by mail-oi1-x230.google.com with SMTP id
5614622812f47-467e8aaa865so3346925b6e.2
for <80688 <at> debbugs.gnu.org>; Tue, 07 Apr 2026 16:06:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1775603172; x=1776207972; 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=UxogIOfuVKW29lUVq70jWCp82KtBn/O3apkkLqMtSxA=;
b=a14cH0AMlKIfvOiRr+fLKdX2UYpWjaTELVSNaw+v1KhNm4GAmON2EZwrS26v2WXeex
3tirgdMcOgx/QG9O3s6OCcM+P42oANLVT/fna63WaaW5mQxZV2g49UYhOEFRIuP8ghH1
VEo99S9Vt7J1Fby7281q+Tt5CNKUxf5Rfsl0DGWl7yhqD/nA9mXGq4XjD5avsH8oGZm3
LTxBaQhgpQPbev+Dps6+R4zfH4bu0obsen8bcXgSKSpb8wSoXP6sH+BQZDd1wwOJ3ZPY
HMwOV7s/M4GgVed2zB/e98YQiThqMNTBk1+cAc2gPm2N02QaHfby/9jLoQVTfgEfW4Ed
+Gzg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1775603172; x=1776207972;
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=UxogIOfuVKW29lUVq70jWCp82KtBn/O3apkkLqMtSxA=;
b=DvFO0tmpcS2XvazkZWCnn3gVVfZ307OI16yVbDGP7x1CYAQqqtOt93AG4PzRAB/AqL
oVW49GRj3roW0Q00XTa4OifB2tdhyC0kQ0edOc7PMyMN9gfkIAtF84x0Zh43iBpvdsPm
/VFbqHxnASu6EXVdzklHF5v6eNn9ZFqs8ELUhAqvu+qd+wZx62zO6MZqxhda8zFUAuiU
tn8jXvkyFMcGjOU9xSl+Y/PhGYEiWIO9H1TkcqI7pSHS6SZBxc5ocSKtKu0kSoPWAbqI
2q8mzqhOOmHchtMrgEiNShIljiV01e7rEj2JueQzo7dVoT2U/jqJfyUtDKbng/b1PhEv
G7HA==
X-Gm-Message-State: AOJu0YyX3imradQrfX0G+mjbPLhUUvG7Ur7TjSArj4mLLTxmSVJpmTrR
i4mn59RQOsWKaw1xi47qUS1dbHLLAx9Lie77Gv6Pfl3syx4JpSYKDrwU2cLhYAp7
X-Gm-Gg: AeBDieu2iGh3P3fU0BTa5qgouazN0TNdemCFw7DQekuUazI3IwratdnkwMSgPS+V+oh
BWzZj8z7fteFjc9xPh+g3pimWx4OkeQzQd1j9G/eTHeiiweB+aCGc5QyeOc7sl9Jx52q+W2Gl0S
dBIJ0LsIjmMY3xiuQ2yB6VIsN4satSNbpG0nLc298NlwMYQo5l31Jiz37O/r1LovIXTKMk7Ym6W
v7n0Pu7cHKdQKyIEGmasAICrr4wxsDb49FX+JsSz0mmHe0i7nMXxG8yPzv/2o+vWpgkC5EAaPwA
FtCHbwpIPoirvvmPNzAWKYlsbc/n7BfUVlKqRw4woB5yF6KypFKH9b6XN/6U7Zp8AECzvfwAltu
U0lyB8hzWy0EiD15hBisFysZOb4HFsY3pjaYZIMR1CrFFLDQyjb4RzlpPhTsFIUbfC9ifYkGKwz
V2NKyERDyrzieKjal8wD2eQ59igm8=
X-Received: by 2002:a05:6808:199b:b0:467:1a69:d0be with SMTP id
5614622812f47-46ef7811261mr10111854b6e.32.1775603171902;
Tue, 07 Apr 2026 16:06:11 -0700 (PDT)
Received: from envy.hsd1.co.comcast.net ([2601:282:1d00:ad10::7451])
by smtp.gmail.com with ESMTPSA id
5614622812f47-4706af49a03sm6993143b6e.8.2026.04.07.16.06.10
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 07 Apr 2026 16:06:10 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: 80688 <at> debbugs.gnu.org
Subject: [PATCH v3 2/2] add shell-command-unique-output-buffer-p
Date: Tue, 7 Apr 2026 17:06:04 -0600
Message-ID: <41b8823784c1eaa54ffbe73fb628c121a35cd8d6.1775602725.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <878qb3dvuw.fsf@HIDDEN>
References: <878qb3dvuw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80688
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-unique-output-buffer-p): New
defcustom. When non-nil, each shell command gets a uniquely named
output buffer derived from the command string, using
`shell-command-buffer-name' or `shell-command-buffer-name-async'
as a prefix.
(shell-command): Use it in async and sync paths.
* lisp/net/tramp.el (tramp-handle-shell-command): Likewise.
* lisp/net/tramp-compat.el: Add compat defvar for
`shell-command-unique-output-buffer-p' for Emacs 28-30.
* etc/NEWS: Document `shell-command-unique-output-buffer-p'.
---
etc/NEWS | 7 +++++++
lisp/net/tramp-compat.el | 5 +++++
lisp/net/tramp.el | 7 +++++++
lisp/simple.el | 26 ++++++++++++++++++++++++++
4 files changed, 45 insertions(+)
diff --git a/etc/NEWS b/etc/NEWS
index 23c7ecac3f8..0bdd2c9b84d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4318,6 +4318,13 @@ This lets a Lisp program access the core functionality of the
program, choosing the program according to the operating system's
conventions.
++++
+** New option 'shell-command-unique-output-buffer-p'.
+When non-nil, each shell command gets its own uniquely named output
+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-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-compat.el b/lisp/net/tramp-compat.el
index 3f947ef1b2c..504eca9c9f9 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -235,6 +235,11 @@ 'tramp-compat-seq-keep
(cdr result)
,variable)))))
+;; `shell-command-unique-output-buffer-p' is new in Emacs 31.1.
+(unless (boundp 'shell-command-unique-output-buffer-p)
+ (defvar shell-command-unique-output-buffer-p nil
+ "If non-nil, give each shell command output its own uniquely named buffer."))
+
(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 3d1cf09b096..ad4ddd50477 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5659,6 +5659,13 @@ tramp-handle-shell-command
shell-command-buffer-name-async
shell-command-buffer-name)))
(or (and (functionp name) (funcall name command))
+ (and shell-command-unique-output-buffer-p
+ (generate-new-buffer-name
+ (if (string-suffix-p "*" name)
+ (format "%s: %s*"
+ (string-remove-suffix "*" name)
+ command)
+ (format "%s: %s" name command))))
name))))))
(error-buffer
(cond
diff --git a/lisp/simple.el b/lisp/simple.el
index 59315714777..d4eaef9ea67 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4312,6 +4312,15 @@ shell-command-buffer-name-async
:group 'shell
:version "31.1")
+(defcustom shell-command-unique-output-buffer-p nil
+ "If non-nil, give each shell command output its own uniquely named buffer.
+The buffer name is derived from the command string, using
+`shell-command-buffer-name' or `shell-command-buffer-name-async' as a
+prefix. Has no effect when those variables hold a function value."
+ :type 'boolean
+ :group 'shell
+ :version "31.1")
+
(defvar shell-command-history nil
"History list for some commands that read shell commands.
@@ -4742,6 +4751,14 @@ shell-command
(and (functionp shell-command-buffer-name-async)
(funcall shell-command-buffer-name-async
command))
+ (and shell-command-unique-output-buffer-p
+ (generate-new-buffer-name
+ (let ((b shell-command-buffer-name-async))
+ (if (string-suffix-p "*" b)
+ (format "%s: %s*"
+ (string-remove-suffix "*" b)
+ command)
+ (format "%s: %s" b command)))))
shell-command-buffer-name-async)))
(bname (buffer-name buffer))
(proc (get-buffer-process buffer))
@@ -4818,6 +4835,15 @@ shell-command
(and (functionp shell-command-buffer-name)
(funcall shell-command-buffer-name
command))
+ (and shell-command-unique-output-buffer-p
+ (generate-new-buffer-name
+ (let ((b shell-command-buffer-name))
+ (if (string-suffix-p "*" b)
+ (format "%s: %s*"
+ (string-remove-suffix
+ "*" b)
+ command)
+ (format "%s: %s" b command)))))
shell-command-buffer-name)
nil error-buffer))))))
--
2.52.0
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.
Received: (at 80688) by debbugs.gnu.org; 7 Apr 2026 23:06:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 19:06:23 2026
Received: from localhost ([127.0.0.1]:43652 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wAFUy-00087w-23
for submit <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:06:23 -0400
Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]:43011)
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 1wAFUp-00086U-G1
for 80688 <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:06:12 -0400
Received: by mail-oi1-x236.google.com with SMTP id
5614622812f47-4704fb0d5b8so266810b6e.0
for <80688 <at> debbugs.gnu.org>; Tue, 07 Apr 2026 16:06:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1775603170; x=1776207970; 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=nOEI6gytSfvxYDH4Ghgb4g88Gyw/mjDtVUAFSfo7YaM=;
b=hxkK7x80w011UJweH0+EJ06udrEXiiZe1uB4R59er4FyCJH14DyBgNIJxkCsOISeX/
dR0xSyCRMImazBOX3S5HjcHm24cBwziwwK8Uy3hmslm+KzfMxdCt5PB7vix8xlmqKaSu
DeXwNrEKwR2X4OvZJtoa5mZPSGUffIA8kH0G3ejU+CxdhQK0491ZTlg/d72kZcFBDsGo
LTY+j56+Eod4Zn9pVAb6VCa0ZgCLeePR8AltrK5ZFqFzSFBhIyIxCKxcSkhSTUSwKY/h
tNCz1p3N5nPmLj+f9VgDDm9p0nkRKAbJzgED+hccht2WuS77Tg26Qg0phU1aMBVP7Uns
TCmg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1775603170; x=1776207970;
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=nOEI6gytSfvxYDH4Ghgb4g88Gyw/mjDtVUAFSfo7YaM=;
b=K//m3joXsxGL4sIJO8zqNtTCZVEmvfYnyRqeRM+eLtopPVXwDlO0oUIKuktw8psRdH
qHMY3jXV5tHteEwvw3Mh8uup0wbmyy+YLPj3kBgaEYxRpwUcopTQLxKTUjKcTRAKKjDf
ugT1qDPkSryhcgJ4mJ4Rcyrh3rvsJH1ikfHDGMtiMLlJEl9vOxRlQ0ySGTIHrZcQeRtS
mOUCBaj13kjqH/gmddKkCqGhz/VMUBuaQQP2/4UTrPdujqE/G8seC8X+A5mdbNFagLgp
sB6WbBXd6ruAFPDlPbVu5a2uKJCAs9xZe2/FJWjI3EknezLBhrIxER/18UA0MimhMgEl
5OIQ==
X-Gm-Message-State: AOJu0Ywd/CzgrXiXJHgG5X/K0YkkXJFnY1GQazZxnDlHzwX6nEdFquF5
BpH83yutOgR5Vb/HwmD+PoJ39hk9958rYpSTUnxc4fKd46FaTW28Pot1cUz1AU0W5xA=
X-Gm-Gg: AeBDiesS6roA7Rl4+M05Mj/xyb1DPPdF7QlXnwtGN9rEiNxC789Jy42Ckyv6qZyiFpy
YUoOC2vRkyno15IxmgSdXn6geEL0qs0pfIRL9VcLNL0EPEJwtF/MBLk0fzaV3ZHa2MINk2zOv0Q
NhBQd+k9i5+h9OwV75aJJfKIJGh5MJwRObW/SzTIPPrwnYh4o4GJMtNgobtmx0kQeQx3OHH0hBJ
jxMYjeVDBFkcaGCzdtGf+aXzFDk4JcoLP4ozaHAjesTbL9Ot+ZysA2pM4jLTCKefNZFWMOT1ZVU
eeLJzEmcRqFKanniaEjZ7+9ATI2vGcIOL0PBk0MuX8FqgH1z/clCrONfrVAtI47ZqiKKkV5Z5f+
LyWvvSuxnwA/Z7Vm621Cbd9PDtYGmHx8inqRZdVVHwXx6NUDQCMIkOEz0nyakQHTfeTQnAKo+Tf
6s3Vl9wEDfMT3uBEYe6ZYTdTU8F5zr+mcQBp03Cg==
X-Received: by 2002:a05:6808:2387:b0:462:a91b:b080 with SMTP id
5614622812f47-46f00b4735fmr9025854b6e.1.1775603170236;
Tue, 07 Apr 2026 16:06:10 -0700 (PDT)
Received: from envy.hsd1.co.comcast.net ([2601:282:1d00:ad10::7451])
by smtp.gmail.com with ESMTPSA id
5614622812f47-4706af49a03sm6993143b6e.8.2026.04.07.16.06.08
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 07 Apr 2026 16:06:09 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: 80688 <at> debbugs.gnu.org
Subject: [PATCH v3 1/2] allow shell-command-buffer-name{,
-async} to be functions
Date: Tue, 7 Apr 2026 17:06:03 -0600
Message-ID: <519126b277144910b8147b892a84611a756bb68f.1775602725.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <878qb3dvuw.fsf@HIDDEN>
References: <878qb3dvuw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80688
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-buffer-name): Change from defconst
to defcustom. The value may now be a string or a function called
with the command string.
(shell-command-buffer-name-async): Likewise.
(shell-command): Evaluate both variables, calling them if they are
functions, before using the result as the output buffer name.
* lisp/net/tramp.el (tramp-handle-shell-command): Likewise.
* etc/NEWS: Document the new function support.
---
etc/NEWS | 6 ++++++
lisp/net/tramp.el | 8 +++++---
lisp/simple.el | 31 +++++++++++++++++++++++++------
3 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 2b4e81fee14..23c7ecac3f8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4318,6 +4318,12 @@ This lets a Lisp program access the core functionality of the
program, choosing the program according to the operating system's
conventions.
++++
+** '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
+string, returning the output buffer name. String values continue to
+work as before.
+
+++
** '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 d67d77fadc6..3d1cf09b096 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5655,9 +5655,11 @@ tramp-handle-shell-command
(setq current-buffer-p t)
(current-buffer))
(t (get-buffer-create
- (if asynchronous
- (or shell-command-buffer-name-async "*Async Shell Command*")
- (or shell-command-buffer-name "*Shell Command Output*"))))))
+ (let ((name (if asynchronous
+ shell-command-buffer-name-async
+ shell-command-buffer-name)))
+ (or (and (functionp name) (funcall name command))
+ name))))))
(error-buffer
(cond
((bufferp error-buffer) error-buffer)
diff --git a/lisp/simple.el b/lisp/simple.el
index ff7ffafa3a1..59315714777 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4296,11 +4296,21 @@ undo-outer-limit-truncate
;;;; Shell commands
-(defconst shell-command-buffer-name "*Shell Command Output*"
- "Name of the output buffer for shell commands.")
+(defcustom shell-command-buffer-name "*Shell Command Output*"
+ "Output buffer name for synchronous shell commands.
+The value may be a string (used directly as the buffer name) or a
+function called with the command string that returns the buffer name."
+ :type '(choice string function)
+ :group 'shell
+ :version "31.1")
-(defconst shell-command-buffer-name-async "*Async Shell Command*"
- "Name of the output buffer for asynchronous shell commands.")
+(defcustom shell-command-buffer-name-async "*Async Shell Command*"
+ "Output buffer name for asynchronous shell commands.
+The value may be a string (used directly as the buffer name) or a
+function called with the command string that returns the buffer name."
+ :type '(choice string function)
+ :group 'shell
+ :version "31.1")
(defvar shell-command-history nil
"History list for some commands that read shell commands.
@@ -4728,7 +4738,11 @@ shell-command
(_ (or (not (string= command ""))
(error "Empty asynchronous command")))
(buffer (get-buffer-create
- (or output-buffer shell-command-buffer-name-async)))
+ (or output-buffer
+ (and (functionp shell-command-buffer-name-async)
+ (funcall shell-command-buffer-name-async
+ command))
+ shell-command-buffer-name-async)))
(bname (buffer-name buffer))
(proc (get-buffer-process buffer))
(directory default-directory))
@@ -4800,7 +4814,12 @@ shell-command
`((name . ,nonce)))))))
;; Otherwise, command is executed synchronously.
(shell-command-on-region (point) (point) command
- output-buffer nil error-buffer))))))
+ (or output-buffer
+ (and (functionp shell-command-buffer-name)
+ (funcall shell-command-buffer-name
+ command))
+ shell-command-buffer-name)
+ nil error-buffer))))))
(defun shell-command--same-buffer-confirm (action)
(let ((help-form
--
2.52.0
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.
Received: (at 80688) by debbugs.gnu.org; 7 Apr 2026 23:06:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 19:06:12 2026
Received: from localhost ([127.0.0.1]:43649 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wAFUq-00086n-C6
for submit <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:06:12 -0400
Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]:49502)
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 1wAFUo-00086H-BY
for 80688 <at> debbugs.gnu.org; Tue, 07 Apr 2026 19:06:11 -0400
Received: by mail-oi1-x22b.google.com with SMTP id
5614622812f47-46fc5b8a04dso2400548b6e.3
for <80688 <at> debbugs.gnu.org>; Tue, 07 Apr 2026 16:06:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1775603168; x=1776207968; 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=epA+r5uL01lqKzat/xgKB/XwtBMe3Ldr+fuWsIG28NY=;
b=ZpoX+kmMWmo7Fn5eNem6uZHtYwIOHM9kifgR/aB0mmyPuRHUF1wx/3q3cl/t87U1WX
7CFODAzAQ17SQGkVn72RvzUgflY66+wRQrAqdb12G9tV112uQ8hZFK920zI78WZgL+vD
gEOaqNjkICqzbGhp+ZoIFY4GfDJWnPfNObsfiaOT5DWIUwfm6sPIUB5B5D7MMcGKrCBe
VWMBGY+3uq9QUBBBU0k1keUtfIIPkWG+KcKkMsglapkt5oOfOVHytJPwGKuftwvOcYWW
6SdCmft+4TkC+E7JoestJpN0l2lorxbyH6SorNmFTBuJ9smH84S36GJNd6vT6JeCFGA5
Q9nA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1775603168; x=1776207968;
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=epA+r5uL01lqKzat/xgKB/XwtBMe3Ldr+fuWsIG28NY=;
b=YnM/x5+Iu7pwFNcR4Pjs1qE7PgeU5qeq++NhTjey9r0RMBimkbNn7JxCsfHdATP2ez
GRkQx/tWeuO/huxN+/MGMVlW83uRthdrzXHKR519c3rQusakKT37aaBvRiOlxQ2sZ/TJ
ouJHI131OVbKYt8B5qT3NWzl9UhZ62oB7GiKl46JmHiU5B0aPqcBbyswsovEQXaYMNzA
BGxv3tAezFHhwYSi3FNmEoT70db7ALHriHgAHZOGm/80luAW0GCiDO5U5AJDAVxbUtFJ
IZhphVA5aEiASOct/K3KCQfRxzn/pXaYG5zjIsg/AR/AadVOhqFy52YhkPYDSZC0HXAp
pQ+Q==
X-Gm-Message-State: AOJu0Yw/r4n0KvqQqtFfqAIprxGVLNMmq+DBB2+eepKcC4P5k3Q26Jci
eAfQpAEO37nFZQqApYTCWtlZglZB2ZpAfzNm8VQguTqgCAluCrTNUiha51oi+JaB9Fs=
X-Gm-Gg: AeBDietPiaUR2ERlAa9LeM5U+t6O88kb/kXvZqv1L99hIIKoLKHOS4UdgJjvo67Awnt
V78hGXvEldcNndK40iL+j0WoWlEs3/eoSG/LrCvbgA5lFqN+OBiRDnoWwfq5olMhj+0L+ficq3Y
fDB7UFT24AXzlTRTlvRTOCBHNB5q9c9JAimwcNVFYjQcUEtu+g7IuoDAaR7B2RhiUr3H407zGSY
MtJQmTt4RakMXezwUahiruI53GvyeI5ZfMW1qcueOoGA8EbZ5gXoINaGLaMZBZqYIq0zvG37pG9
rQ8NvQrQ7Y/OBVXXQKoSxBTnYeGKOQNWFsNu5wHPatIXaN99uvuVQJxZadwSbDhyPf98fEtCsNl
UmfExlVcuZJTgZ+kTgAF+nNoVzPc0zP4g4h2isZBNPtHxWL5e+G7waInG/QF3BHdH61Epj52MiP
3GMrCDhRNUNSwmTaPNnrq96nmSJVS7V0TDjoay6w==
X-Received: by 2002:a05:6808:6b98:b0:467:880:743b with SMTP id
5614622812f47-46ef65ede9dmr9436583b6e.22.1775603168518;
Tue, 07 Apr 2026 16:06:08 -0700 (PDT)
Received: from envy.hsd1.co.comcast.net ([2601:282:1d00:ad10::7451])
by smtp.gmail.com with ESMTPSA id
5614622812f47-4706af49a03sm6993143b6e.8.2026.04.07.16.06.05
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 07 Apr 2026 16:06:07 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: 80688 <at> debbugs.gnu.org
Subject: [PATCH v3 0/2] extend shell-command buffer naming
Date: Tue, 7 Apr 2026 17:06:02 -0600
Message-ID: <cover.1775602725.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <878qb3dvuw.fsf@HIDDEN>
References: <878qb3dvuw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80688
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 extends shell-command's buffer naming with two new options.
Patch 1 allows shell-command-buffer-name and shell-command-buffer-name-async
to accept a function as their value. When they hold a function, it is called
with the command string and its return value is used as the buffer name.
String values continue to behave exactly as before.
Patch 2 adds shell-command-unique-output-buffer-p. When non-nil, each
command gets its own uniquely named buffer derived from the base buffer name
variable and the command string, using generate-new-buffer-name to avoid
collisions.
S.C. Morris (2):
allow shell-command-buffer-name{,-async} to be functions
add shell-command-unique-output-buffer-p
etc/NEWS | 13 +++++++++
lisp/net/tramp-compat.el | 5 ++++
lisp/net/tramp.el | 15 ++++++++---
lisp/simple.el | 57 +++++++++++++++++++++++++++++++++++-----
4 files changed, 81 insertions(+), 9 deletions(-)
--
2.52.0
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.Received: (at 80688) by debbugs.gnu.org; 4 Apr 2026 07:32:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 04 03:32:18 2026 Received: from localhost ([127.0.0.1]:41875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w8vUQ-0001oV-D5 for submit <at> debbugs.gnu.org; Sat, 04 Apr 2026 03:32:18 -0400 Received: from mout.gmx.net ([212.227.17.22]:42363) 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 1w8vUN-0001oC-F1 for 80688 <at> debbugs.gnu.org; Sat, 04 Apr 2026 03:32:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1775287928; x=1775892728; i=michael.albinus@HIDDEN; bh=zWBMwSTIFMNfrwCLlLJAmstYsM627Dc5l+jzZs0DO6M=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=LT2A0mk72rOsqiJ3qY10kbGRA5kNQjrUWuk7FyGTnJhkmx2uq7G7hBWodRy+Vrmh DwtrUDpqKfD8VdTVhLqmwg5e7oM8jPPtaLEKJFh9+RIunQIEech5Ai6LfF814XGQV uRXjvduL1vSZlUCjXGFgq1NC/ix2BPIe9OYspPttVgZPeGOp+bbDKTmZD9mc79kE6 327TDXupZNmJJHd8LdBv6MCYP5te+FeeFo/vajliVZNU2cF3li3j3v2wuV4LNnW1c MU673rgrr/IIFbEB39ErqLGNXcVifVQd+Hd2YLM09SGsWBeAt8Dh88bdXWXWyvzjk hshZQDEo822J1OaYvw== 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 1MtOGU-1vLtbS0Bdm-00xvp1; Sat, 04 Apr 2026 09:32:08 +0200 From: Michael Albinus <michael.albinus@HIDDEN> To: Samuel Morris <scmorris.dev@HIDDEN> Subject: Re: bug#80688: [PATCH 1/2] add shell-command-unique-output-buffer-p, shell-command-buffer-name-function In-Reply-To: <CAEkeNzhEUj2JiL+zjRKFeVTTpzMV0empFQdjEcoJC_Y753NcxA@HIDDEN> References: <877bqofr9h.fsf@HIDDEN> <5f36a6c7e613daa7a3b47051a8dff0d42e72d144.1775230196.git.scmorris.dev@HIDDEN> <CAEkeNzhEUj2JiL+zjRKFeVTTpzMV0empFQdjEcoJC_Y753NcxA@HIDDEN> Date: Sat, 04 Apr 2026 09:32:07 +0200 Message-ID: <878qb3dvuw.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:1MV48TF3ualIrc7NrJ2RpnRcChWPJbZTagefqiXB2cYoibScd7e zEPOiAqRPlflODvKfbU9dC7MVlJiprLa3/MpPJKpujvtwb+riUKphQz8+f0ryqEfIhsAUe0 RBK04Ic6hzZIpKWanxYQGevINzocIBhiZjH1DShqAQmlGr7bwGQnZFXYkgXLeneCMKBp7Nx gbI/RJCR+F7DJn6ZFYeaw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:zmMe+glRQQ8=;A6deVhbFYubMcBo60T+DGKo9RsH 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 2vxF6i44pyUVsC+k8SKfG+jw== Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80688 Cc: 80688 <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, > This patch version just adds in the tramp-compat changes to not break > older versions of tramp, as Michael rightly pointed out.=20 Thanks. Nitpick: you shall add tramp-compat.el to the commit message. Best regards, Michael.
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.Received: (at 80688) by debbugs.gnu.org; 3 Apr 2026 22:54:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 03 18:54:07 2026 Received: from localhost ([127.0.0.1]:36104 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w8nOw-0000Jq-RK for submit <at> debbugs.gnu.org; Fri, 03 Apr 2026 18:54:07 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]:48318) 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 1w8nOt-0000JQ-Bg for 80688 <at> debbugs.gnu.org; Fri, 03 Apr 2026 18:54:04 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-b9c1da7ac63so394447066b.0 for <80688 <at> debbugs.gnu.org>; Fri, 03 Apr 2026 15:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775256841; cv=none; d=google.com; s=arc-20240605; b=RpobnUlbuooPQuzZoj6QfRWryT4NVKwoB9Ju0VqlHH56WjV1fQz/wAO7zIrWRHJvKI 9nHXwUuQEzl6hFLL+8aNOYbVL5BFnLzWKlGbOr7QAG0DgOctNc+/BewYF4lJ0ebRIS0J i43zNUwVnQnz7cPafkTRMP6i0SK4VBVDkxCEQc3nK4Ah3KCz9Eh5zNdgWiLkiQUXKlQV k/dG1uIDpl2g/45J4tE3GYEl1mStFePUYtSYftWPcIy/YbSZhieS3uEob8dv77zi3vjl cAR3HjvxoM4cG6tZkqUc2vN7urZkvmrNT129nNBfBDIsm3FaGYZKZR7LhtqbSiAuqGse 4ePA== 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=sasU6sL/YxhqxD9psbseIkfY/MzO3Mx/D3Ev68i0DU4=; fh=PeH+Lg+OELzg/lbk/uqv7xB7Je1Oe4+DEa70ePjYX8I=; b=TyN8oa3suubcqQR6g5WKH0Yg+ikB0d5Z0zFT5T8IXHuW5klMqJHtKCcJ8gGud1MsNL lGE8sWqHjAXkU9n0e673kXjxWHbPFHn9ICF38XZkDIhDb9sKECa30y7w03jRvR33VRNf zgr2sDlkvVhk2EBuEz26Mes9D7mzjIFeyYE06jDCAoJB2ov550o8DVy7M6NizEFYdz23 dpMebcS70R4nNwNEmo5X0mELnAxfNOkXM6ThUKgJ0xYZ6j1H8laMewGLYFXol4IxKXHC Nus4IKR3OEAsGv83mQf6v25bnFoT3q8cJugjY//N6Q1i5aNi0d4VjDgHr399aJYObdHK GmfA==; 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=1775256841; x=1775861641; 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=sasU6sL/YxhqxD9psbseIkfY/MzO3Mx/D3Ev68i0DU4=; b=oLl/ENpBNqfrj7pecrACwJRnpWLfeg0K0RBQnYPKpMPS1NVF4Lw1gkrsFtP8ghU8PE NEmEqpOrnM9NSBZ041E5FGixMUVM/T6bcWePsSPYAGRtlEhE2yi9+6jKGGnyjKUYHuSN zerIFiBcOJMFG/l4jS9OJNhz2bsj/NDmQGD45Ha9wbr+sLD8ZnpSj34vihF7Tot39+CH L+07I3UPG7RB2GJcTly010XiXjDUK9EgNJMv0cu5xlnNkd4RlIoeC8BLwNBo84INZYGN vSXdXtNid+mdtdWZ/pTq06hc1PMVogcwPIul6IWPzbDhHt7SpohDnRZPI1pWAyIoP81T mBzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775256841; x=1775861641; 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=sasU6sL/YxhqxD9psbseIkfY/MzO3Mx/D3Ev68i0DU4=; b=ViMmm1x0JSAeqhtSpyCftVvB8Vq/m1GH4MARhrhgA3p60d1W1cS2aL0Jk/ggb3Fh+n FSFLiGQRGIsYU7fngYXFhXUPeDWADdSXqDVOwJCQTsShLFNKgc9jE0GDZ0yjqKRgAcjn epjNLbBe7Oepk8JYf02u79Z+fpsdL5zdQE+lcxOLzk4SEx+YaG2C2ntVHlybPC7wHvVq 1vlaujllyR9P1H4GM0JI5+xTQvCPZPDm3I9oUM7GsWsLaE77j2wmHuRc29eUgpjOdfcb 7JAJuZ/JsA3v4/km+irXqYSn9i0PP5EtLdgRYiT4P/AYdvDiGSPjDfeuj15GGE2zETyk aE8A== X-Gm-Message-State: AOJu0Yx8wvDhJEwO6yyp1uqNSYJu4utXRxl504XIMvm8wZe6hVDMNw17 yVHzW3GC9XVf1wJid/L1jHqWpWxVnGLdD7mEWxZDi9HPgNlEnkH0TLtRhLOPcbmvryxqwNrrkud J9QKlRNTVEyS2nBsJ8t0hKam+uAjmhquSYakD X-Gm-Gg: AeBDieuwBwN7XBrCoyQ3aB1cf+B2mbzFB5/O/Chfx/glSxS+udHrtYIXj7ky4SRwvbt pRbkk8sruwCG0yxqcayK221s3EYcy8t2FhmpK9HBSunTEdfJVV9/xWvZN2BTl2f+Fdp0q7kUPxT 5+76UxnEKEgSKnXHgzxwJDTHAN8uHF26PaWYl5VtIMhJgqfSGERB6HWmkO1tNJbkfU7luWM/CcP ioxuDqa4orxeTw2gqYcIG5pdyEEQeHiFV0fttGb00hEnVkdkyBki+n63CmRZttM1pFIkuTdemvr isRU X-Received: by 2002:a17:906:9f91:b0:b96:e8b1:3483 with SMTP id a640c23a62f3a-b9c67b80aa8mr242196666b.50.1775256840681; Fri, 03 Apr 2026 15:54:00 -0700 (PDT) MIME-Version: 1.0 References: <877bqofr9h.fsf@HIDDEN> <5f36a6c7e613daa7a3b47051a8dff0d42e72d144.1775230196.git.scmorris.dev@HIDDEN> In-Reply-To: <5f36a6c7e613daa7a3b47051a8dff0d42e72d144.1775230196.git.scmorris.dev@HIDDEN> From: Samuel Morris <scmorris.dev@HIDDEN> Date: Fri, 3 Apr 2026 16:53:48 -0600 X-Gm-Features: AQROBzBRgQYoeJXsmo_ti7P3XjDHv_D_udkt1WIkx-2FLwfmEdrQzHRGcf3aMQI Message-ID: <CAEkeNzhEUj2JiL+zjRKFeVTTpzMV0empFQdjEcoJC_Y753NcxA@HIDDEN> Subject: Re: [PATCH 1/2] add shell-command-unique-output-buffer-p, shell-command-buffer-name-function To: 80688 <at> debbugs.gnu.org Content-Type: multipart/alternative; boundary="0000000000005fbbc0064e9631d1" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80688 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 (/) --0000000000005fbbc0064e9631d1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 3, 2026 at 4:47=E2=80=AFPM <scmorris.dev@HIDDEN> wrote: > From: "S.C. Morris" <scmorris.dev@HIDDEN> > > * lisp/simple.el (shell-command-unique-output-buffer-p): New defcustom. > When non-nil, each async shell command gets a uniquely named output > buffer derived from the command string. > (shell-command-buffer-name-function): New defvar. If non-nil, called > with the command string to produce the output buffer name. Takes > precedence over `shell-command-unique-output-buffer-p'. > (shell-command): Use both new variables in async and sync paths. > > * lisp/net/tramp.el (tramp-handle-shell-command): Likewise. > > * etc/NEWS: Document both new variables. > --- > etc/NEWS | 12 ++++++++++++ > lisp/net/tramp-compat.el | 10 ++++++++++ > lisp/net/tramp.el | 11 ++++++++--- > lisp/simple.el | 40 ++++++++++++++++++++++++++++++++++++++-- > 4 files changed, 68 insertions(+), 5 deletions(-) > > diff --git a/etc/NEWS b/etc/NEWS > index 2b4e81fee14..0a9f197eaf8 100644 > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -4318,6 +4318,18 @@ This lets a Lisp program access the core > functionality of the > program, choosing the program according to the operating system's > conventions. > > ++++ > +** New option 'shell-command-unique-output-buffer-p'. > +When non-nil, each shell command gets its own uniquely named output > +buffer based on the command string, rather than reusing a shared buffer. > + > ++++ > +** New variable 'shell-command-buffer-name-function'. > +If non-nil, this function is called with the command string and should > +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'. > + > +++ > ** '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 3f947ef1b2c..43a097f65e0 100644 > --- a/lisp/net/tramp-compat.el > +++ b/lisp/net/tramp-compat.el > @@ -235,6 +235,16 @@ 'tramp-compat-seq-keep > (cdr result) > ,variable))))) > > +;; `shell-command-buffer-name-function' is new in Emacs 31.1. > +(unless (boundp 'shell-command-buffer-name-function) > + (defvar shell-command-buffer-name-function nil > + "If non-nil, function to generate the output buffer name for shell > commands.")) > + > +;; `shell-command-unique-output-buffer-p' is new in Emacs 31.1. > +(unless (boundp 'shell-command-unique-output-buffer-p) > + (defvar shell-command-unique-output-buffer-p nil > + "If non-nil, give each shell command output its own uniquely named > buffer.")) > + > (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 d67d77fadc6..f9abe4d6135 100644 > --- a/lisp/net/tramp.el > +++ b/lisp/net/tramp.el > @@ -5655,9 +5655,14 @@ tramp-handle-shell-command > (setq current-buffer-p t) > (current-buffer)) > (t (get-buffer-create > - (if asynchronous > - (or shell-command-buffer-name-async "*Async Shell > Command*") > - (or shell-command-buffer-name "*Shell Command > Output*")))))) > + (or (and shell-command-buffer-name-function > + (funcall shell-command-buffer-name-function > command)) > + (and shell-command-unique-output-buffer-p > + (generate-new-buffer-name > + (format "*Shell Command: %s*" command))) > + (if asynchronous > + (or shell-command-buffer-name-async "*Async Shell > Command*") > + (or shell-command-buffer-name "*Shell Command > Output*")))))))) > (error-buffer > (cond > ((bufferp error-buffer) error-buffer) > diff --git a/lisp/simple.el b/lisp/simple.el > index ff7ffafa3a1..fea990c09d7 100644 > --- a/lisp/simple.el > +++ b/lisp/simple.el > @@ -4302,6 +4302,21 @@ shell-command-buffer-name > (defconst shell-command-buffer-name-async "*Async Shell Command*" > "Name of the output buffer for asynchronous shell commands.") > > +(defcustom shell-command-unique-output-buffer-p nil > + "If non-nil, give each shell command output its own uniquely named > buffer. > +The buffer name is derived from the command string and made unique. > +For full control over buffer naming, use > `shell-command-buffer-name-function'." > + :type 'boolean > + :group 'shell > + :version "31.1") > + > +(defvar shell-command-buffer-name-function nil > + "If non-nil, function to generate the output buffer name for shell > commands. > +Called with one argument, the command string (without any trailing `&'), > +and should return a buffer name string. When nil, the default names > +`shell-command-buffer-name' and `shell-command-buffer-name-async' are > used. > +This takes precedence over `shell-command-unique-output-buffer-p'.") > + > (defvar shell-command-history nil > "History list for some commands that read shell commands. > > @@ -4645,6 +4660,13 @@ shell-command > In an interactive call, the variable `shell-command-default-error-buffer= ' > specifies the value of ERROR-BUFFER. > > +If `shell-command-unique-output-buffer-p' is non-nil, each command gets > +its own uniquely named output buffer based on the command string. > +If `shell-command-buffer-name-function' is non-nil, it is called with > +COMMAND to generate the output buffer name; this takes precedence over > +`shell-command-unique-output-buffer-p', `shell-command-buffer-name', and > +`shell-command-buffer-name-async'. > + > 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)." > @@ -4728,7 +4750,14 @@ shell-command > (_ (or (not (string=3D command "")) > (error "Empty asynchronous command"))) > (buffer (get-buffer-create > - (or output-buffer > shell-command-buffer-name-async))) > + (or output-buffer > + (and shell-command-buffer-name-function > + (funcall > shell-command-buffer-name-function > + command)) > + (and shell-command-unique-output-buffer-= p > + (generate-new-buffer-name > + (format "*Shell Command: %s*" > command))) > + shell-command-buffer-name-async))) > (bname (buffer-name buffer)) > (proc (get-buffer-process buffer)) > (directory default-directory)) > @@ -4800,7 +4829,14 @@ shell-command > `((name . ,nonce))))))) > ;; Otherwise, command is executed synchronously. > (shell-command-on-region (point) (point) command > - output-buffer nil error-buffer)))))) > + (or output-buffer > + (and > shell-command-buffer-name-function > + (funcall > shell-command-buffer-name-function > + command)) > + (and > shell-command-unique-output-buffer-p > + (generate-new-buffer-name > + (format "*Shell Command: > %s*" command)))) > + nil error-buffer)))))) > > (defun shell-command--same-buffer-confirm (action) > (let ((help-form > -- > 2.52.0 > > This patch version just adds in the tramp-compat changes to not break older versions of tramp, as Michael rightly pointed out. --0000000000005fbbc0064e9631d1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr">On Fri, Apr 3, 2026 at 4= :47=E2=80=AFPM <<a href=3D"mailto:scmorris.dev@HIDDEN" target=3D"_bla= nk">scmorris.dev@HIDDEN</a>> wrote:</div><div class=3D"gmail_quote"><= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">From: "S.C. Morris&qu= ot; <<a href=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmorri= s.dev@HIDDEN</a>><br> <br> * lisp/simple.el (shell-command-unique-output-buffer-p): New defcustom.<br> When non-nil, each async shell command gets a uniquely named output<br> buffer derived from the command string.<br> (shell-command-buffer-name-function): New defvar.=C2=A0 If non-nil, called<= br> with the command string to produce the output buffer name.=C2=A0 Takes<br> precedence over `shell-command-unique-output-buffer-p'.<br> (shell-command): Use both new variables in async and sync paths.<br> <br> * lisp/net/tramp.el (tramp-handle-shell-command): Likewise.<br> <br> * etc/NEWS: Document both new variables.<br> ---<br> =C2=A0etc/NEWS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0| 12 ++++++++++++<br> =C2=A0lisp/net/tramp-compat.el | 10 ++++++++++<br> =C2=A0lisp/net/tramp.el=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 11 ++++++++---<br> =C2=A0lisp/simple.el=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 40 +++++++++= +++++++++++++++++++++++++++++--<br> =C2=A04 files changed, 68 insertions(+), 5 deletions(-)<br> <br> diff --git a/etc/NEWS b/etc/NEWS<br> index 2b4e81fee14..0a9f197eaf8 100644<br> --- a/etc/NEWS<br> +++ b/etc/NEWS<br> @@ -4318,6 +4318,18 @@ This lets a Lisp program access the core functionali= ty of the<br> =C2=A0program, choosing the program according to the operating system's= <br> =C2=A0conventions.<br> <br> ++++<br> +** New option 'shell-command-unique-output-buffer-p'.<br> +When non-nil, each shell command gets its own uniquely named output<br> +buffer based on the command string, rather than reusing a shared buffer.<b= r> +<br> ++++<br> +** New variable 'shell-command-buffer-name-function'.<br> +If non-nil, this function is called with the command string and should<br> +return the output buffer name.=C2=A0 It takes precedence over<br> +'shell-command-unique-output-buffer-p', 'shell-command-buffer-= name', and<br> +'shell-command-buffer-name-async'.<br> +<br> =C2=A0+++<br> =C2=A0** 'make-vtable' 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 3f947ef1b2c..43a097f65e0 100644<br> --- a/lisp/net/tramp-compat.el<br> +++ b/lisp/net/tramp-compat.el<br> @@ -235,6 +235,16 @@ 'tramp-compat-seq-keep<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cdr result)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ,variable)))))<br> <br> +;; `shell-command-buffer-name-function' is new in Emacs 31.1.<br> +(unless (boundp 'shell-command-buffer-name-function)<br> +=C2=A0 (defvar shell-command-buffer-name-function nil<br> +=C2=A0 =C2=A0 "If non-nil, function to generate the output buffer nam= e for shell commands."))<br> +<br> +;; `shell-command-unique-output-buffer-p' is new in Emacs 31.1.<br> +(unless (boundp 'shell-command-unique-output-buffer-p)<br> +=C2=A0 (defvar shell-command-unique-output-buffer-p nil<br> +=C2=A0 =C2=A0 "If non-nil, give each shell command output its own uni= quely named buffer."))<br> +<br> =C2=A0(dolist (elt (apropos-internal (rx bos "tramp-compat-") #&#= 39;functionp))<br> =C2=A0 =C2=A0(function-put elt 'tramp-suppress-trace t))<br> <br> diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el<br> index d67d77fadc6..f9abe4d6135 100644<br> --- a/lisp/net/tramp.el<br> +++ b/lisp/net/tramp.el<br> @@ -5655,9 +5655,14 @@ tramp-handle-shell-command<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq current-buffer-p t)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (current-buffer))<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(t (get-buffer-create<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if asynchronous<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or shell-c= ommand-buffer-name-async "*Async Shell Command*")<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or shell-command-= buffer-name "*Shell Command Output*"))))))<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or (and shell-command-bu= ffer-name-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(funcall shell-command-buffer-name-function command))<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (and shell-= command-unique-output-buffer-p<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(generate-new-buffer-name<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 (format "*Shell Command: %s*" command)))<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if asynchr= onous<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (or shell-command-buffer-name-async "*Async Shell Command*")<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or = shell-command-buffer-name "*Shell Command Output*"))))))))<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(error-buffer<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cond<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((bufferp error-buffer) error-buff= er)<br> diff --git a/lisp/simple.el b/lisp/simple.el<br> index ff7ffafa3a1..fea990c09d7 100644<br> --- a/lisp/simple.el<br> +++ b/lisp/simple.el<br> @@ -4302,6 +4302,21 @@ shell-command-buffer-name<br> =C2=A0(defconst shell-command-buffer-name-async "*Async Shell Command*= "<br> =C2=A0 =C2=A0"Name of the output buffer for asynchronous shell command= s.")<br> <br> +(defcustom shell-command-unique-output-buffer-p nil<br> +=C2=A0 "If non-nil, give each shell command output its own uniquely n= amed buffer.<br> +The buffer name is derived from the command string and made unique.<br> +For full control over buffer naming, use `shell-command-buffer-name-functi= on'."<br> +=C2=A0 :type 'boolean<br> +=C2=A0 :group 'shell<br> +=C2=A0 :version "31.1")<br> +<br> +(defvar shell-command-buffer-name-function nil<br> +=C2=A0 "If non-nil, function to generate the output buffer name for s= hell commands.<br> +Called with one argument, the command string (without any trailing `&&= #39;),<br> +and should return a buffer name string.=C2=A0 When nil, the default names<= br> +`shell-command-buffer-name' and `shell-command-buffer-name-async' = are used.<br> +This takes precedence over `shell-command-unique-output-buffer-p'.&quo= t;)<br> +<br> =C2=A0(defvar shell-command-history nil<br> =C2=A0 =C2=A0"History list for some commands that read shell commands.= <br> <br> @@ -4645,6 +4660,13 @@ shell-command<br> =C2=A0In an interactive call, the variable `shell-command-default-error-buf= fer'<br> =C2=A0specifies the value of ERROR-BUFFER.<br> <br> +If `shell-command-unique-output-buffer-p' is non-nil, each command get= s<br> +its own uniquely named output buffer based on the command string.<br> +If `shell-command-buffer-name-function' is non-nil, it is called with<= br> +COMMAND to generate the output buffer name; this takes precedence over<br> +`shell-command-unique-output-buffer-p', `shell-command-buffer-name'= ;, and<br> +`shell-command-buffer-name-async'.<br> +<br> =C2=A0In Elisp, you will often be better served by calling `call-process= 9; or<br> =C2=A0`start-process' directly, since they offer more control and do no= t<br> =C2=A0impose the use of a shell (with its need to quote arguments)."<b= r> @@ -4728,7 +4750,14 @@ shell-command<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (_ (o= r (not (string=3D command ""))<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(error "Empty asynchronous command")))<br= > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (buff= er (get-buffer-create<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 (or output-buffer shell-command-buffer-name-async)= ))<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 (or output-buffer<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 (and shell-command-buffer-name-funct= ion<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 =C2=A0 =C2=A0 =C2=A0(funcall shell-c= ommand-buffer-name-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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 command))<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 (and shell-command-unique-output-buf= fer-p<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 =C2=A0 =C2=A0 =C2=A0(generate-new-bu= ffer-name<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 =C2=A0 =C2=A0 =C2=A0 (format "*= Shell Command: %s*" command)))<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 shell-command-buffer-name-async)))<b= r> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (bnam= e (buffer-name buffer))<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (proc= (get-buffer-process buffer))<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (dire= ctory default-directory))<br> @@ -4800,7 +4829,14 @@ shell-command<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 =C2=A0 =C2=A0`((name . ,nonce)))))))= <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Otherwise, command is executed synchr= onously.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (shell-command-on-region (point) (point)= command<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 =C2=A0 output-buffer nil error-buffe= r))))))<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 =C2=A0 (or output-buffer<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 =C2=A0 =C2=A0 =C2=A0 =C2=A0(and shel= l-command-buffer-name-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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (funcall shell-command-buffer-name-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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0command))<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 =C2=A0 =C2=A0 =C2=A0 =C2=A0(and shel= l-command-unique-output-buffer-p<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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (generate-new-buffer-name<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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(format "*Shell Command: %s*" command))))<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 =C2=A0 =C2=A0nil error-buffer))))))<= br> <br> =C2=A0(defun shell-command--same-buffer-confirm (action)<br> =C2=A0 =C2=A0(let ((help-form<br> -- <br> 2.52.0<br> <br></blockquote><div><br></div><div>This patch version just adds in the tr= amp-compat changes to not break older versions of tramp, as Michael rightly= pointed out.=C2=A0</div></div></div> </div> --0000000000005fbbc0064e9631d1--
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.
Received: (at 80688) by debbugs.gnu.org; 3 Apr 2026 22:47:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 03 18:47:49 2026
Received: from localhost ([127.0.0.1]:36031 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1w8nIq-0008Pf-31
for submit <at> debbugs.gnu.org; Fri, 03 Apr 2026 18:47:48 -0400
Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]:44165)
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 1w8nIo-0008PV-A2
for 80688 <at> debbugs.gnu.org; Fri, 03 Apr 2026 18:47:46 -0400
Received: by mail-oo1-xc31.google.com with SMTP id
006d021491bc7-67e2c70864aso1393518eaf.0
for <80688 <at> debbugs.gnu.org>; Fri, 03 Apr 2026 15:47:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1775256465; x=1775861265; 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=GubiUrS+qTfsnGq/KqBzY/LOC75rh0FAedPoaJdO9v8=;
b=QlBzLG6ordjdjBKCwBAGV9bCF2Vt/qqdtOu7G2Yg7Puc6x5lGixoiGysY1JRi+mvN6
OLVWf7tN8UWOEbTSbNbJHyZk5JO6DRMh3mtqY8KY5BCc8ZgHCRd7dDFTjZy8R9reTmLc
O/qZMFo+w5R1dZv1hqZEkzGdLh6L7/hoptnb1E3fu8J/Z9kzvSsvEhCjU8WuCj6B0DSf
v5a6BPB0dfGtSP4GvLQTmZTQ3LxGEJ/2SUuklAiNbwbuKfVv2aJ1plD/GBe9+t+0fGR+
HJ2swS1PnHBpLWl8Nuoc2bDgB816aQPkiovDKT0PnGi21GNP2v3/KODE0e+/gJYVsyhZ
xyNA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1775256465; x=1775861265;
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=GubiUrS+qTfsnGq/KqBzY/LOC75rh0FAedPoaJdO9v8=;
b=XhSXuwiyKLyQ+4V5Wz6Om0jfNCNEhq3aG0sftE1pUJlxYSFr+rKOKWsoyjN+9yMiK8
yFzIpcIpl5jwdeRfu455DD8lvpbnKqZlwMBQivWIWuIRDGMrgCJqAqA2sJhDgoB+yZba
foYX+AprpLKGwNPOLBr7jOSTviKo70rySb5GEtcV369MIfaBc1tUejhvXzc2SJW1+Afm
mJqWtFe6FzwSA5AILZZC/TRut92KgSGXKl0DaFG+9gGw8UtLc/Sm1aGVFFLKgNmSj08i
TGg4oiQV+hJ99SmGOeGSgSoyN8QtUbqngJZa1zsju+Zr7roU7Pw9vG5OvrbukJ0f9jT/
K/qQ==
X-Gm-Message-State: AOJu0YylMjhxxYfKodha2JBH10UN5h5aW1IaE6KknFfAIyHvhZ2hWOSn
JTJ8m55HYO7RGlAJp48HB5qCRRghs4V134pNoDLqOVRh1D7h6Hb5Ehc7uwiql8qA
X-Gm-Gg: ATEYQzyhxTs9QBl8Vnc7V/k1wT9Eyp66IlcoKUuysptOTmX6YQO0o3rbhKNLBVRjE/F
ivysekTX9FFOi410OdJEZgewGr4eLCPpNWClbLW5LFwj1W6UQ2ud+9oWj7SIFIKfjY3NcuV2+IP
dnWX8vVdNC+7QryfD5jfwOd9uW7uGjxx3+ONpy2QPv995iOxlztwc0Up3cEOqPfF3iI9pERzhn3
xnZEtM7xD2DgIqvov0tZpkma5F6z0A81CfV2hbwis+GRae4cGWuTRjprLUTGIW97MZr9xaD5kds
Eeattzpu53uLMLNFfZReSFF47uMSgD8drsepB8OPigdfjJaNNNELNvRYrJi/ei8O8jGsukkNp3I
o7qff901Xg9oMZH1CtiDEHRxoQZybFvsRBwbMzvTC/n502RTOfIvDk6+W49j2jbZKNK4rCSVpi5
jIJ+FsMA4SEg7s3JDz9Syn5Tg4X9g0Ckbydmw=
X-Received: by 2002:a05:6820:628d:b0:67c:f1d7:3d50 with SMTP id
006d021491bc7-6821f675b01mr1675618eaf.32.1775256464790;
Fri, 03 Apr 2026 15:47:44 -0700 (PDT)
Received: from envy.tail20243e.ts.net ([2601:282:1d00:ad10::7451])
by smtp.gmail.com with ESMTPSA id
006d021491bc7-680a58f7455sm4524145eaf.5.2026.04.03.15.47.42
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 03 Apr 2026 15:47:44 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: 80688 <at> debbugs.gnu.org
Subject: [PATCH 1/2] add shell-command-unique-output-buffer-p,
shell-command-buffer-name-function
Date: Fri, 3 Apr 2026 16:47:41 -0600
Message-ID: <5f36a6c7e613daa7a3b47051a8dff0d42e72d144.1775230196.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <877bqofr9h.fsf@HIDDEN>
References: <877bqofr9h.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80688
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-unique-output-buffer-p): New defcustom.
When non-nil, each async shell command gets a uniquely named output
buffer derived from the command string.
(shell-command-buffer-name-function): New defvar. If non-nil, called
with the command string to produce the output buffer name. Takes
precedence over `shell-command-unique-output-buffer-p'.
(shell-command): Use both new variables in async and sync paths.
* lisp/net/tramp.el (tramp-handle-shell-command): Likewise.
* etc/NEWS: Document both new variables.
---
etc/NEWS | 12 ++++++++++++
lisp/net/tramp-compat.el | 10 ++++++++++
lisp/net/tramp.el | 11 ++++++++---
lisp/simple.el | 40 ++++++++++++++++++++++++++++++++++++++--
4 files changed, 68 insertions(+), 5 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 2b4e81fee14..0a9f197eaf8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4318,6 +4318,18 @@ This lets a Lisp program access the core functionality of the
program, choosing the program according to the operating system's
conventions.
++++
+** New option 'shell-command-unique-output-buffer-p'.
+When non-nil, each shell command gets its own uniquely named output
+buffer based on the command string, rather than reusing a shared buffer.
+
++++
+** New variable 'shell-command-buffer-name-function'.
+If non-nil, this function is called with the command string and should
+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'.
+
+++
** '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 3f947ef1b2c..43a097f65e0 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -235,6 +235,16 @@ 'tramp-compat-seq-keep
(cdr result)
,variable)))))
+;; `shell-command-buffer-name-function' is new in Emacs 31.1.
+(unless (boundp 'shell-command-buffer-name-function)
+ (defvar shell-command-buffer-name-function nil
+ "If non-nil, function to generate the output buffer name for shell commands."))
+
+;; `shell-command-unique-output-buffer-p' is new in Emacs 31.1.
+(unless (boundp 'shell-command-unique-output-buffer-p)
+ (defvar shell-command-unique-output-buffer-p nil
+ "If non-nil, give each shell command output its own uniquely named buffer."))
+
(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 d67d77fadc6..f9abe4d6135 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5655,9 +5655,14 @@ tramp-handle-shell-command
(setq current-buffer-p t)
(current-buffer))
(t (get-buffer-create
- (if asynchronous
- (or shell-command-buffer-name-async "*Async Shell Command*")
- (or shell-command-buffer-name "*Shell Command Output*"))))))
+ (or (and shell-command-buffer-name-function
+ (funcall shell-command-buffer-name-function command))
+ (and shell-command-unique-output-buffer-p
+ (generate-new-buffer-name
+ (format "*Shell Command: %s*" command)))
+ (if asynchronous
+ (or shell-command-buffer-name-async "*Async Shell Command*")
+ (or shell-command-buffer-name "*Shell Command Output*"))))))))
(error-buffer
(cond
((bufferp error-buffer) error-buffer)
diff --git a/lisp/simple.el b/lisp/simple.el
index ff7ffafa3a1..fea990c09d7 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4302,6 +4302,21 @@ shell-command-buffer-name
(defconst shell-command-buffer-name-async "*Async Shell Command*"
"Name of the output buffer for asynchronous shell commands.")
+(defcustom shell-command-unique-output-buffer-p nil
+ "If non-nil, give each shell command output its own uniquely named buffer.
+The buffer name is derived from the command string and made unique.
+For full control over buffer naming, use `shell-command-buffer-name-function'."
+ :type 'boolean
+ :group 'shell
+ :version "31.1")
+
+(defvar shell-command-buffer-name-function nil
+ "If non-nil, function to generate the output buffer name for shell commands.
+Called with one argument, the command string (without any trailing `&'),
+and should return a buffer name string. When nil, the default names
+`shell-command-buffer-name' and `shell-command-buffer-name-async' are used.
+This takes precedence over `shell-command-unique-output-buffer-p'.")
+
(defvar shell-command-history nil
"History list for some commands that read shell commands.
@@ -4645,6 +4660,13 @@ shell-command
In an interactive call, the variable `shell-command-default-error-buffer'
specifies the value of ERROR-BUFFER.
+If `shell-command-unique-output-buffer-p' is non-nil, each command gets
+its own uniquely named output buffer based on the command string.
+If `shell-command-buffer-name-function' is non-nil, it is called with
+COMMAND to generate the output buffer name; this takes precedence over
+`shell-command-unique-output-buffer-p', `shell-command-buffer-name', and
+`shell-command-buffer-name-async'.
+
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)."
@@ -4728,7 +4750,14 @@ shell-command
(_ (or (not (string= command ""))
(error "Empty asynchronous command")))
(buffer (get-buffer-create
- (or output-buffer shell-command-buffer-name-async)))
+ (or output-buffer
+ (and shell-command-buffer-name-function
+ (funcall shell-command-buffer-name-function
+ command))
+ (and shell-command-unique-output-buffer-p
+ (generate-new-buffer-name
+ (format "*Shell Command: %s*" command)))
+ shell-command-buffer-name-async)))
(bname (buffer-name buffer))
(proc (get-buffer-process buffer))
(directory default-directory))
@@ -4800,7 +4829,14 @@ shell-command
`((name . ,nonce)))))))
;; Otherwise, command is executed synchronously.
(shell-command-on-region (point) (point) command
- output-buffer nil error-buffer))))))
+ (or output-buffer
+ (and shell-command-buffer-name-function
+ (funcall shell-command-buffer-name-function
+ command))
+ (and shell-command-unique-output-buffer-p
+ (generate-new-buffer-name
+ (format "*Shell Command: %s*" command))))
+ nil error-buffer))))))
(defun shell-command--same-buffer-confirm (action)
(let ((help-form
--
2.52.0
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.Received: (at 80688) by debbugs.gnu.org; 3 Apr 2026 07:16:26 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 03 03:16:25 2026 Received: from localhost ([127.0.0.1]:55161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w8YlT-0008Q7-6c for submit <at> debbugs.gnu.org; Fri, 03 Apr 2026 03:16:25 -0400 Received: from mout.gmx.net ([212.227.15.15]:42949) 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 1w8YlO-0008P2-2y for 80688 <at> debbugs.gnu.org; Fri, 03 Apr 2026 03:16:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1775200571; x=1775805371; i=michael.albinus@HIDDEN; bh=q2axgCz4XnzC4GT8ee23ZyD7J6a+FZyRoQQQ2ya2/Tc=; 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=fbYf67tSnM9vyDj5MRuQQ98ID4MDCi8tfEf/xvCmS0KmEIEc2f4nbxDZLsizVjeS XAZo8HpNrkPodTDymUCAjUSEva/RvGPSOGCPEMQtg0QdwWqfD24l73+vj6DQJOH+e QTemKeTsEsuv+27bQi4el827Q2JCXZpadDe1eO9YClr7y4UXYaS7MbGqQb0ovC9Hh U61grv9Xy6wNVkkfG3qKZbm1QnhEG/Yg//FNBQBlFJ4vGEkhljMwMz5nkIJEb26wj QNHV7n/wrkJjp+ziRFS0Vx3yodzFn0YlOL4/XcoP+Hq+thVz66VSSDMZb+LeJ2qN9 f2przlhkyMDbki9LVg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from client.hidden.invalid by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MXXyP-1vzwii0ypr-00WAVR; Fri, 03 Apr 2026 09:16:11 +0200 From: Michael Albinus <michael.albinus@HIDDEN> To: Samuel Morris <scmorris.dev@HIDDEN> Subject: Re: bug#80688: [PATCH 1/2] add shell-command-unique-output-buffer-p, shell-command-buffer-name-function In-Reply-To: <CAEkeNzgJajMDkJX7j-yLq5wH-G556siRzm7ThoA0rHRoUx2Wuw@HIDDEN> References: <875x6azofi.fsf@HIDDEN> <08dd55fbb9d66bee2501198e659b08112e0e00b1.1775143646.git.scmorris.dev@HIDDEN> <CAEkeNzgJajMDkJX7j-yLq5wH-G556siRzm7ThoA0rHRoUx2Wuw@HIDDEN> Date: Fri, 03 Apr 2026 09:16:10 +0200 Message-ID: <877bqofr9h.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:LvRaNc8v+9YZsjbduqqaBSzkdE40ZTXPBlzXMDTuBoaxMUpImKz aUBVzrJBd/F+eV1Y3FnH8l+rUT8sKM7DuxIi8IP6ALoMzVlHJb8L36NjqDRKBlSXH1rXG8A sxVDB+P2BQ9G27G4BqM2w0vYfWXHgwTIhnFlFHTrL1DuqVvr6JCFJ5Ai5DDguHDALtJqnWi jg/L458ke+6ovXYtRqluQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:2LJh6WFBKkc=;gVeBWHLaSf6mZLbT9hmRC2EEVu+ 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 IC0mbEhxM+s56YIm3sFJ0z7g== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80688 Cc: 80688 <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 second proposal that integrates feedback from the > previous comments. In particular: > > * I added a customizable option that automatically renames the output > buffer based on the command. > * I mirrored these changes in tramp. Thanks. Tramp is backward compatible down to Emacs 28, so you must implement the compatibility dance. See tramp-compat.el for examples. Best regards, Michael.
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.Received: (at 80688) by debbugs.gnu.org; 2 Apr 2026 20:37:31 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 02 16:37:31 2026 Received: from localhost ([127.0.0.1]:47823 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w8OnC-00051U-2V for submit <at> debbugs.gnu.org; Thu, 02 Apr 2026 16:37:31 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:53728) 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 1w8OnA-00051D-8d for 80688 <at> debbugs.gnu.org; Thu, 02 Apr 2026 16:37:29 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-b9961e4f71bso201555966b.3 for <80688 <at> debbugs.gnu.org>; Thu, 02 Apr 2026 13:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775162246; cv=none; d=google.com; s=arc-20240605; b=dAcvNQLMnodeAs/848dTA0bQueDjPmK4MyoikmlLNWrRVawbNNhvLMsyX5pD5QCpFm mMAIMv4obPRm0qCe4QciyW5+bOCH5TI1SKNr3t1I01guWEr2HGivb1OZLynHCkhADwt3 9QGlYSF2tJ92nIZ31SkaL9W+67kobB3Xht90DlyxwOR3ban9n0SI+sY59yf8gglPQ5zP R6+36NJamSnpjSwAbKPBl5uMgsf+VmVRbsSN9HxHEZTprZrGDs6owqna1TiX5w5f0T4q A+0JfAtq8tARiFOVnTZ5SlRu5KWR6OWFDeH6MvMzg36O42JGYcOiN5SdWSyBrT6k9rfa s7nA== 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=W3mXNxvB04vLKX+8NrD45Mv7N1SsXKtRmLKL6BTYcVg=; fh=PeH+Lg+OELzg/lbk/uqv7xB7Je1Oe4+DEa70ePjYX8I=; b=DemeSpFHtUSv/D6Hw0kUhNOHgildjGw8ZtqO55UxWqU4ffgKJtiw8dHORkwVf/6IZo MvYAYs9z5tyBjrq7F7IhKAVyUsvzYXpuLRIjyI+opaDh40UctHlOR83C0YqWVPZ+RDkK VjKItg5CJWYtEAIKsUEDFfYqMnNCcwzsNB1Vn3KVP1LYnVdApC8VnpENpZMHqrD+U6qH BL4nmapsM4Dx7P48KZsebBEPoJN4FwWzTW5oEzhkTdtUAymacb3RlDvSm/jsg66qGNBI oV/MB566Tjrl+Nk7NmaAYAxe8B/4iAZ/y09CP7zAgQx/Ct0SKFH/XycmG0vrzZTJ/vFt 398g==; 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=1775162246; x=1775767046; 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=W3mXNxvB04vLKX+8NrD45Mv7N1SsXKtRmLKL6BTYcVg=; b=jdO38O8dnOWJ61kO/a5izhLy7wuRxxupDAIOVCQdiq/THeJPVdpXoYGmvW13wR9CG5 f8n0FBUFP3/y/ASw1Vzp5jUCmmEDbx4JYDYR0E9klSHwZQsHi+AHRHnDCCWDv5AAHPHK /HN7iULRc2JHktzB8z6kvJrShFMaYf8d96UVayldN4nuJTvPzSu7J76AxPxuCFIVXMur 7xNS297IiHqNdjYUx97iHklJvQZ2hPl6oypLOpZemgauVoFU3fEYCZa2nEvwq+O3ejLC Emh3RhGjPzKuyEyi1nV6muLyJmVHaME5+gANu/TO4qJ2AHNutj+eAdal2IhISNVpcprD WQew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775162246; x=1775767046; 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=W3mXNxvB04vLKX+8NrD45Mv7N1SsXKtRmLKL6BTYcVg=; b=iUn1/XhZ6/gI8jVh5gRNpKsS8L2Eu4KRKpwtEsJJTodhwUm8R+W7eUYaeGgHy1bl+t DI3xQAzv1vmo/J4S5m74Efl+PR0llTxwrpNuMOSjGYNkVDQKkG8cRDykcs5poSUzmHAm 7DSo7cu0FcJM1MsVVD6WyuKFn5A+0KMYg95C3jheE5uW5SzzRT2mooqPNO1E6aPJ2l5o X7dCp/WX6e8t3SuM0o94s9z2hsBENxD8WK0ohvp6NmRJrr0VaERY5hYjmMEKDpG8O265 iv7M/h1/1/n9mVFOoB8szCNxfJ//bG91bAZ9skokAhhEHTRxec9ERVZW78xMrIU/iyWQ bTPg== X-Gm-Message-State: AOJu0YznnePVi3qmQUPAhs3a1BYKdnZdOblebrIaT8VHi9o1sQ36F0kY 9kILu3nfVoxbZrG60QXTBpseRrNId5d0XLFS/fiZvIGlLAAjgx5PNbQOS6ReYryYt/K/Qdg03JJ YpPAKhNmv53DBlGA0Vu+T+IsEHMSecDGAzsBW3Y0= X-Gm-Gg: ATEYQzwUr86NDPSQBGAvoXvO0ImhH3DKlF2etISQsLZEuDoKm6kzPRMkmpDAhJYn33L UqSRjsq6n3Kza4hLUGCnAdY3jQfhqSMu0VcTj2gwM48xaEGep5dM2FLncoBoB+fAWFgZOphyvFB 64eApbu6yZZXbG1XjoVYK4kQOfPc7e8ODRVB27NKkyy47ZVnkG8kPHzbBoOt5U/VNm7cIMza79D OPc9WxDGlsxcHj1i/n+MFZV1AM/ef4rREQdt2+1dSjzAo2qsY2BvXI/r4PgjY0erM9F7C9Dmwrs WJalyepHig/hON8= X-Received: by 2002:a17:907:809:b0:b98:8692:bc3e with SMTP id a640c23a62f3a-b9c672b3461mr15478466b.9.1775162246229; Thu, 02 Apr 2026 13:37:26 -0700 (PDT) MIME-Version: 1.0 References: <875x6azofi.fsf@HIDDEN> <08dd55fbb9d66bee2501198e659b08112e0e00b1.1775143646.git.scmorris.dev@HIDDEN> In-Reply-To: <08dd55fbb9d66bee2501198e659b08112e0e00b1.1775143646.git.scmorris.dev@HIDDEN> From: Samuel Morris <scmorris.dev@HIDDEN> Date: Thu, 2 Apr 2026 14:37:14 -0600 X-Gm-Features: AQROBzCjSlEjeY4Yo6XFW_mgLNSgBtTfodB7YUqHBgGTsLPN-ZitdqApYwB9r3U Message-ID: <CAEkeNzgJajMDkJX7j-yLq5wH-G556siRzm7ThoA0rHRoUx2Wuw@HIDDEN> Subject: Re: [PATCH 1/2] add shell-command-unique-output-buffer-p, shell-command-buffer-name-function To: 80688 <at> debbugs.gnu.org Content-Type: multipart/alternative; boundary="0000000000001af4b2064e802b74" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80688 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 (/) --0000000000001af4b2064e802b74 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 2, 2026 at 2:28=E2=80=AFPM <scmorris.dev@HIDDEN> wrote: > From: "S.C. Morris" <scmorris.dev@HIDDEN> > > * lisp/simple.el (shell-command-unique-output-buffer-p): New defcustom. > When non-nil, each async shell command automatically gets a assigned > a unique output buffer name derived from the command string. > (shell-command-buffer-name-function): New defvar. If non-nil, called > with the command string to produce the output buffer name. Takes > precedence over `shell-command-unique-output-buffer-p'. > (shell-command): Use both new variables in async and sync paths. > > * lisp/net/tramp.el (tramp-handle-shell-command): changes are mirrored > here. > > * etc/NEWS: Document both new variables. > --- > etc/NEWS | 12 ++++++++++++ > lisp/net/tramp.el | 11 ++++++++--- > lisp/simple.el | 40 ++++++++++++++++++++++++++++++++++++++-- > 3 files changed, 58 insertions(+), 5 deletions(-) > > diff --git a/etc/NEWS b/etc/NEWS > index 2b4e81fee14..0a9f197eaf8 100644 > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -4318,6 +4318,18 @@ This lets a Lisp program access the core > functionality of the > program, choosing the program according to the operating system's > conventions. > > ++++ > +** New option 'shell-command-unique-output-buffer-p'. > +When non-nil, each shell command gets its own uniquely named output > +buffer based on the command string, rather than reusing a shared buffer. > + > ++++ > +** New variable 'shell-command-buffer-name-function'. > +If non-nil, this function is called with the command string and should > +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'. > + > +++ > ** '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 d67d77fadc6..f9abe4d6135 100644 > --- a/lisp/net/tramp.el > +++ b/lisp/net/tramp.el > @@ -5655,9 +5655,14 @@ tramp-handle-shell-command > (setq current-buffer-p t) > (current-buffer)) > (t (get-buffer-create > - (if asynchronous > - (or shell-command-buffer-name-async "*Async Shell > Command*") > - (or shell-command-buffer-name "*Shell Command > Output*")))))) > + (or (and shell-command-buffer-name-function > + (funcall shell-command-buffer-name-function > command)) > + (and shell-command-unique-output-buffer-p > + (generate-new-buffer-name > + (format "*Shell Command: %s*" command))) > + (if asynchronous > + (or shell-command-buffer-name-async "*Async Shell > Command*") > + (or shell-command-buffer-name "*Shell Command > Output*")))))))) > (error-buffer > (cond > ((bufferp error-buffer) error-buffer) > diff --git a/lisp/simple.el b/lisp/simple.el > index ff7ffafa3a1..fea990c09d7 100644 > --- a/lisp/simple.el > +++ b/lisp/simple.el > @@ -4302,6 +4302,21 @@ shell-command-buffer-name > (defconst shell-command-buffer-name-async "*Async Shell Command*" > "Name of the output buffer for asynchronous shell commands.") > > +(defcustom shell-command-unique-output-buffer-p nil > + "If non-nil, give each shell command output its own uniquely named > buffer. > +The buffer name is derived from the command string and made unique. > +For full control over buffer naming, use > `shell-command-buffer-name-function'." > + :type 'boolean > + :group 'shell > + :version "31.1") > + > +(defvar shell-command-buffer-name-function nil > + "If non-nil, function to generate the output buffer name for shell > commands. > +Called with one argument, the command string (without any trailing `&'), > +and should return a buffer name string. When nil, the default names > +`shell-command-buffer-name' and `shell-command-buffer-name-async' are > used. > +This takes precedence over `shell-command-unique-output-buffer-p'.") > + > (defvar shell-command-history nil > "History list for some commands that read shell commands. > > @@ -4645,6 +4660,13 @@ shell-command > In an interactive call, the variable `shell-command-default-error-buffer= ' > specifies the value of ERROR-BUFFER. > > +If `shell-command-unique-output-buffer-p' is non-nil, each command gets > +its own uniquely named output buffer based on the command string. > +If `shell-command-buffer-name-function' is non-nil, it is called with > +COMMAND to generate the output buffer name; this takes precedence over > +`shell-command-unique-output-buffer-p', `shell-command-buffer-name', and > +`shell-command-buffer-name-async'. > + > 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)." > @@ -4728,7 +4750,14 @@ shell-command > (_ (or (not (string=3D command "")) > (error "Empty asynchronous command"))) > (buffer (get-buffer-create > - (or output-buffer > shell-command-buffer-name-async))) > + (or output-buffer > + (and shell-command-buffer-name-function > + (funcall > shell-command-buffer-name-function > + command)) > + (and shell-command-unique-output-buffer-= p > + (generate-new-buffer-name > + (format "*Shell Command: %s*" > command))) > + shell-command-buffer-name-async))) > (bname (buffer-name buffer)) > (proc (get-buffer-process buffer)) > (directory default-directory)) > @@ -4800,7 +4829,14 @@ shell-command > `((name . ,nonce))))))) > ;; Otherwise, command is executed synchronously. > (shell-command-on-region (point) (point) command > - output-buffer nil error-buffer)))))) > + (or output-buffer > + (and > shell-command-buffer-name-function > + (funcall > shell-command-buffer-name-function > + command)) > + (and > shell-command-unique-output-buffer-p > + (generate-new-buffer-name > + (format "*Shell Command: > %s*" command)))) > + nil error-buffer)))))) > > (defun shell-command--same-buffer-confirm (action) > (let ((help-form > -- > 2.52.0 > > So this is just a second proposal that integrates feedback from the previous comments. In particular: * I added a customizable option that automatically renames the output buffer based on the command. * I mirrored these changes in tramp. Please let me know if I did not submit this correctly, I was a little unsure of the correct process, or if you have any questions. --0000000000001af4b2064e802b74 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:28=E2=80=AFPM &l= t;<a href=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmorris.dev@= gmail.com</a>> wrote:</div><div class=3D"gmail_quote"><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">From: "S.C. Morris" <<a href= =3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmorris.dev@HIDDEN= </a>><br> <br> * lisp/simple.el (shell-command-unique-output-buffer-p): New defcustom.<br> When non-nil, each async shell command automatically gets a assigned<br> a unique output buffer name derived from the command string.<br> (shell-command-buffer-name-function): New defvar.=C2=A0 If non-nil, called<= br> with the command string to produce the output buffer name.=C2=A0 Takes<br> precedence over `shell-command-unique-output-buffer-p'.<br> (shell-command): Use both new variables in async and sync paths.<br> <br> * lisp/net/tramp.el (tramp-handle-shell-command): changes are mirrored<br> here.<br> <br> * etc/NEWS: Document both new variables.<br> ---<br> =C2=A0etc/NEWS=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 12 ++++++++++++<br> =C2=A0lisp/net/tramp.el | 11 ++++++++---<br> =C2=A0lisp/simple.el=C2=A0 =C2=A0 | 40 ++++++++++++++++++++++++++++++++++++= ++--<br> =C2=A03 files changed, 58 insertions(+), 5 deletions(-)<br> <br> diff --git a/etc/NEWS b/etc/NEWS<br> index 2b4e81fee14..0a9f197eaf8 100644<br> --- a/etc/NEWS<br> +++ b/etc/NEWS<br> @@ -4318,6 +4318,18 @@ This lets a Lisp program access the core functionali= ty of the<br> =C2=A0program, choosing the program according to the operating system's= <br> =C2=A0conventions.<br> <br> ++++<br> +** New option 'shell-command-unique-output-buffer-p'.<br> +When non-nil, each shell command gets its own uniquely named output<br> +buffer based on the command string, rather than reusing a shared buffer.<b= r> +<br> ++++<br> +** New variable 'shell-command-buffer-name-function'.<br> +If non-nil, this function is called with the command string and should<br> +return the output buffer name.=C2=A0 It takes precedence over<br> +'shell-command-unique-output-buffer-p', 'shell-command-buffer-= name', and<br> +'shell-command-buffer-name-async'.<br> +<br> =C2=A0+++<br> =C2=A0** 'make-vtable' 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 d67d77fadc6..f9abe4d6135 100644<br> --- a/lisp/net/tramp.el<br> +++ b/lisp/net/tramp.el<br> @@ -5655,9 +5655,14 @@ tramp-handle-shell-command<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq current-buffer-p t)<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (current-buffer))<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(t (get-buffer-create<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if asynchronous<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or shell-c= ommand-buffer-name-async "*Async Shell Command*")<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or shell-command-= buffer-name "*Shell Command Output*"))))))<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or (and shell-command-bu= ffer-name-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(funcall shell-command-buffer-name-function command))<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (and shell-= command-unique-output-buffer-p<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(generate-new-buffer-name<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 (format "*Shell Command: %s*" command)))<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if asynchr= onous<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (or shell-command-buffer-name-async "*Async Shell Command*")<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or = shell-command-buffer-name "*Shell Command Output*"))))))))<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(error-buffer<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cond<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((bufferp error-buffer) error-buff= er)<br> diff --git a/lisp/simple.el b/lisp/simple.el<br> index ff7ffafa3a1..fea990c09d7 100644<br> --- a/lisp/simple.el<br> +++ b/lisp/simple.el<br> @@ -4302,6 +4302,21 @@ shell-command-buffer-name<br> =C2=A0(defconst shell-command-buffer-name-async "*Async Shell Command*= "<br> =C2=A0 =C2=A0"Name of the output buffer for asynchronous shell command= s.")<br> <br> +(defcustom shell-command-unique-output-buffer-p nil<br> +=C2=A0 "If non-nil, give each shell command output its own uniquely n= amed buffer.<br> +The buffer name is derived from the command string and made unique.<br> +For full control over buffer naming, use `shell-command-buffer-name-functi= on'."<br> +=C2=A0 :type 'boolean<br> +=C2=A0 :group 'shell<br> +=C2=A0 :version "31.1")<br> +<br> +(defvar shell-command-buffer-name-function nil<br> +=C2=A0 "If non-nil, function to generate the output buffer name for s= hell commands.<br> +Called with one argument, the command string (without any trailing `&&= #39;),<br> +and should return a buffer name string.=C2=A0 When nil, the default names<= br> +`shell-command-buffer-name' and `shell-command-buffer-name-async' = are used.<br> +This takes precedence over `shell-command-unique-output-buffer-p'.&quo= t;)<br> +<br> =C2=A0(defvar shell-command-history nil<br> =C2=A0 =C2=A0"History list for some commands that read shell commands.= <br> <br> @@ -4645,6 +4660,13 @@ shell-command<br> =C2=A0In an interactive call, the variable `shell-command-default-error-buf= fer'<br> =C2=A0specifies the value of ERROR-BUFFER.<br> <br> +If `shell-command-unique-output-buffer-p' is non-nil, each command get= s<br> +its own uniquely named output buffer based on the command string.<br> +If `shell-command-buffer-name-function' is non-nil, it is called with<= br> +COMMAND to generate the output buffer name; this takes precedence over<br> +`shell-command-unique-output-buffer-p', `shell-command-buffer-name'= ;, and<br> +`shell-command-buffer-name-async'.<br> +<br> =C2=A0In Elisp, you will often be better served by calling `call-process= 9; or<br> =C2=A0`start-process' directly, since they offer more control and do no= t<br> =C2=A0impose the use of a shell (with its need to quote arguments)."<b= r> @@ -4728,7 +4750,14 @@ shell-command<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (_ (o= r (not (string=3D command ""))<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(error "Empty asynchronous command")))<br= > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (buff= er (get-buffer-create<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 (or output-buffer shell-command-buffer-name-async)= ))<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 (or output-buffer<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 (and shell-command-buffer-name-funct= ion<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 =C2=A0 =C2=A0 =C2=A0(funcall shell-c= ommand-buffer-name-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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 command))<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 (and shell-command-unique-output-buf= fer-p<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 =C2=A0 =C2=A0 =C2=A0(generate-new-bu= ffer-name<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 =C2=A0 =C2=A0 =C2=A0 (format "*= Shell Command: %s*" command)))<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 shell-command-buffer-name-async)))<b= r> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (bnam= e (buffer-name buffer))<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (proc= (get-buffer-process buffer))<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (dire= ctory default-directory))<br> @@ -4800,7 +4829,14 @@ shell-command<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 =C2=A0 =C2=A0`((name . ,nonce)))))))= <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Otherwise, command is executed synchr= onously.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (shell-command-on-region (point) (point)= command<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 =C2=A0 output-buffer nil error-buffe= r))))))<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 =C2=A0 (or output-buffer<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 =C2=A0 =C2=A0 =C2=A0 =C2=A0(and shel= l-command-buffer-name-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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (funcall shell-command-buffer-name-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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0command))<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 =C2=A0 =C2=A0 =C2=A0 =C2=A0(and shel= l-command-unique-output-buffer-p<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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (generate-new-buffer-name<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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(format "*Shell Command: %s*" command))))<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 =C2=A0 =C2=A0nil error-buffer))))))<= br> <br> =C2=A0(defun shell-command--same-buffer-confirm (action)<br> =C2=A0 =C2=A0(let ((help-form<br> -- <br> 2.52.0<br> <br></blockquote><div>=C2=A0</div><div>So this is just a second proposal th= at integrates feedback from the<br>previous comments. In particular:<br><br= >* I added a customizable option that automatically renames the output<br>= =C2=A0 buffer based on the command.<br>* I mirrored these changes in tramp.= <br><br>Please let me know if I did not submit this correctly, I was a litt= le<br>unsure of the correct process, or if you have any questions.=C2=A0</d= iv></div> </div> --0000000000001af4b2064e802b74--
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.
Received: (at 80688) by debbugs.gnu.org; 2 Apr 2026 20:28:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 02 16:28:30 2026
Received: from localhost ([127.0.0.1]:47676 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1w8OeT-0004C3-KF
for submit <at> debbugs.gnu.org; Thu, 02 Apr 2026 16:28:30 -0400
Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]:49591)
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 1w8OeR-0004Bn-Iq
for 80688 <at> debbugs.gnu.org; Thu, 02 Apr 2026 16:28:28 -0400
Received: by mail-ot1-x32a.google.com with SMTP id
46e09a7af769-7d7fdb922a5so996109a34.3
for <80688 <at> debbugs.gnu.org>; Thu, 02 Apr 2026 13:28:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1775161705; x=1775766505; 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=qfLW7EhIbyOJ+TKXghtW6fypZZA5Vw3TT9sNuYXn49M=;
b=i9BT9vWSWn5lZ+kB9FleoiqNbaHeOYoB5fyAHid/KTq5O+tqTi5NQL5oAiVYoCes14
4GF1fGca19lgOacgJ50QRZaZuIirTFJHN8bdA0J2+Rp45/FdxbfmACCrYqd1oNu9s51z
53xCt+BeBqZWXpyzRkbkX+nLxM9A6ndC/9DydkhImgHFSQnZ3O4TSmN7otSR3k90Wvd6
w9Z5iiR7DcQ00eWvym4j77ouzsAEtz9TfjEIYWaJbmnQu4U5l6K9X1fCUPA+oc1+OQa6
M7OT2wx16ISFa7+DJj0yJITgRc+siN4nqirowanrPZCbCyal1VpadPUxLGpPDUWVHEWQ
CrLg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1775161705; x=1775766505;
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=qfLW7EhIbyOJ+TKXghtW6fypZZA5Vw3TT9sNuYXn49M=;
b=onTgMSRPgTp3nWUtC+xRL47z9g4Y7BQTu5P2uROCN1EFGnefUd7XFMeQoFQ2sBt2Q2
JvxUTeUp4+HMIHvq7IllrNF5JnCnRcTNDfiJqUQApq7/F6USmIklGLTZ+WK//c22d3G4
uaFv0sI0FnDp7ee38rpZx8gNeJ7EC6g6BHHawcelsWf5EjMs+u+Z62biWUF46Oi4F+LT
6pNLMAI9z5Y+6iu0Tsl1QY7CVUlJk+MLY96IWEJgLjgubTEiRO6NzTRZTLAvNKHV/Gho
eGayZDa+zYQ1oq5eK3JJyjY++DO6lP8ARNvwJZBA8jmFWO4phHqZCzhiakhBZALcdeCa
uqtA==
X-Gm-Message-State: AOJu0YyZ+nIQ1lO6toNTU2uMiI60eWWLUnNwvyXK4r0GY86VfXQykcQn
Mz7X6RZb34Ja2SKVoJ0TcUBH+EtBV8Adg7Ms+Y6rygCLTRizIEoO9zWxNl9+tDPw
X-Gm-Gg: ATEYQzzKb9o+uQrFWM9ZPHW4GQaoPvkHH5kPnEEoDMuLDkGvBybj6ygOrlSCpBRzqA2
OycB6vG4nSOyixfVN34beKBMisqHItcb+IjCj/kVToE+4eQMHO+bbtizo4XEuoZ/SBNuKWp5i5O
WLD26kyjvm4yVMl7OrLfhCCCE/ZXiLr/dP3nP7Tpps0yF0tBwp6ggx6J+ZsEdLaUx6RwYO988PR
u87iCzNKVgeTzaeecwZ4h/ke/Ni+fr2gppHjqwewOdPs8y7afbkYrbcOpfKmYW8U/teUQo8EnIE
gmvjt82AXsMtvkRTCw4G5a4qhswmt8gZUOPW6foASPAElyq8do4uyPi0KSujYKQMJ2EZO7EtWjZ
RH87T9xg9u7k8PdxuKLAXy+JNYgAw3xg+2GLIkt+2u2XiazQzMO6vQTIEF+WD0Da7MdxiUy+JPR
vJLzuXsLgwwtLkfBm/zHf1AzpO
X-Received: by 2002:a05:6830:8291:b0:7d9:7201:1acf with SMTP id
46e09a7af769-7dbb6ee7d3amr504114a34.5.1775161705259;
Thu, 02 Apr 2026 13:28:25 -0700 (PDT)
Received: from envy.tail20243e.ts.net ([2601:282:1d00:ad10::7451])
by smtp.gmail.com with ESMTPSA id
46e09a7af769-7dba73964c8sm2767113a34.25.2026.04.02.13.28.24
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 02 Apr 2026 13:28:24 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: 80688 <at> debbugs.gnu.org
Subject: [PATCH 1/2] add shell-command-unique-output-buffer-p,
shell-command-buffer-name-function
Date: Thu, 2 Apr 2026 14:28:23 -0600
Message-ID: <08dd55fbb9d66bee2501198e659b08112e0e00b1.1775143646.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
In-Reply-To: <875x6azofi.fsf@HIDDEN>
References: <875x6azofi.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80688
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-unique-output-buffer-p): New defcustom.
When non-nil, each async shell command automatically gets a assigned
a unique output buffer name derived from the command string.
(shell-command-buffer-name-function): New defvar. If non-nil, called
with the command string to produce the output buffer name. Takes
precedence over `shell-command-unique-output-buffer-p'.
(shell-command): Use both new variables in async and sync paths.
* lisp/net/tramp.el (tramp-handle-shell-command): changes are mirrored
here.
* etc/NEWS: Document both new variables.
---
etc/NEWS | 12 ++++++++++++
lisp/net/tramp.el | 11 ++++++++---
lisp/simple.el | 40 ++++++++++++++++++++++++++++++++++++++--
3 files changed, 58 insertions(+), 5 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 2b4e81fee14..0a9f197eaf8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4318,6 +4318,18 @@ This lets a Lisp program access the core functionality of the
program, choosing the program according to the operating system's
conventions.
++++
+** New option 'shell-command-unique-output-buffer-p'.
+When non-nil, each shell command gets its own uniquely named output
+buffer based on the command string, rather than reusing a shared buffer.
+
++++
+** New variable 'shell-command-buffer-name-function'.
+If non-nil, this function is called with the command string and should
+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'.
+
+++
** '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 d67d77fadc6..f9abe4d6135 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5655,9 +5655,14 @@ tramp-handle-shell-command
(setq current-buffer-p t)
(current-buffer))
(t (get-buffer-create
- (if asynchronous
- (or shell-command-buffer-name-async "*Async Shell Command*")
- (or shell-command-buffer-name "*Shell Command Output*"))))))
+ (or (and shell-command-buffer-name-function
+ (funcall shell-command-buffer-name-function command))
+ (and shell-command-unique-output-buffer-p
+ (generate-new-buffer-name
+ (format "*Shell Command: %s*" command)))
+ (if asynchronous
+ (or shell-command-buffer-name-async "*Async Shell Command*")
+ (or shell-command-buffer-name "*Shell Command Output*"))))))))
(error-buffer
(cond
((bufferp error-buffer) error-buffer)
diff --git a/lisp/simple.el b/lisp/simple.el
index ff7ffafa3a1..fea990c09d7 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4302,6 +4302,21 @@ shell-command-buffer-name
(defconst shell-command-buffer-name-async "*Async Shell Command*"
"Name of the output buffer for asynchronous shell commands.")
+(defcustom shell-command-unique-output-buffer-p nil
+ "If non-nil, give each shell command output its own uniquely named buffer.
+The buffer name is derived from the command string and made unique.
+For full control over buffer naming, use `shell-command-buffer-name-function'."
+ :type 'boolean
+ :group 'shell
+ :version "31.1")
+
+(defvar shell-command-buffer-name-function nil
+ "If non-nil, function to generate the output buffer name for shell commands.
+Called with one argument, the command string (without any trailing `&'),
+and should return a buffer name string. When nil, the default names
+`shell-command-buffer-name' and `shell-command-buffer-name-async' are used.
+This takes precedence over `shell-command-unique-output-buffer-p'.")
+
(defvar shell-command-history nil
"History list for some commands that read shell commands.
@@ -4645,6 +4660,13 @@ shell-command
In an interactive call, the variable `shell-command-default-error-buffer'
specifies the value of ERROR-BUFFER.
+If `shell-command-unique-output-buffer-p' is non-nil, each command gets
+its own uniquely named output buffer based on the command string.
+If `shell-command-buffer-name-function' is non-nil, it is called with
+COMMAND to generate the output buffer name; this takes precedence over
+`shell-command-unique-output-buffer-p', `shell-command-buffer-name', and
+`shell-command-buffer-name-async'.
+
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)."
@@ -4728,7 +4750,14 @@ shell-command
(_ (or (not (string= command ""))
(error "Empty asynchronous command")))
(buffer (get-buffer-create
- (or output-buffer shell-command-buffer-name-async)))
+ (or output-buffer
+ (and shell-command-buffer-name-function
+ (funcall shell-command-buffer-name-function
+ command))
+ (and shell-command-unique-output-buffer-p
+ (generate-new-buffer-name
+ (format "*Shell Command: %s*" command)))
+ shell-command-buffer-name-async)))
(bname (buffer-name buffer))
(proc (get-buffer-process buffer))
(directory default-directory))
@@ -4800,7 +4829,14 @@ shell-command
`((name . ,nonce)))))))
;; Otherwise, command is executed synchronously.
(shell-command-on-region (point) (point) command
- output-buffer nil error-buffer))))))
+ (or output-buffer
+ (and shell-command-buffer-name-function
+ (funcall shell-command-buffer-name-function
+ command))
+ (and shell-command-unique-output-buffer-p
+ (generate-new-buffer-name
+ (format "*Shell Command: %s*" command))))
+ nil error-buffer))))))
(defun shell-command--same-buffer-confirm (action)
(let ((help-form
--
2.52.0
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.Received: (at 80688) by debbugs.gnu.org; 1 Apr 2026 16:08:44 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 01 12:08:44 2026 Received: from localhost ([127.0.0.1]:58090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w7y7X-0002WH-Ch for submit <at> debbugs.gnu.org; Wed, 01 Apr 2026 12:08:43 -0400 Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101]:48138) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1w7y7S-0002Uf-D3 for 80688 <at> debbugs.gnu.org; Wed, 01 Apr 2026 12:08:40 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4fm8zf127Dz9tR2; Wed, 1 Apr 2026 18:08:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1775059710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EkdEixTNXSY7j7/ZFqBhjS708UHU8tXzcBPpDa0ZZUc=; b=K7JyY+yk6kgqLqhfmxepau0y+ZyggSGJH+s7uI0ZlFAFpghJfsF6hGyu3xZkO3yq/lPs0I 2sPgHN4O3FgPZHou52IlnJlL7r5FdJMIYCrVK133NH8KhjF47oC0Saa0onAceYI6P+GNzu ALbVe/T68/41PkdRZ3nT4xmLdTSbF3GLwWQFKRVzr1zUA3CiEuEjDW3b6exmGJG4ICFt91 z5Oou1RfZzx0mmVdKTpETkWTrZnENvmPmhB4vh/NPUC3bh1P3vBj40s6RtNMfJ7yKnrEUE L3QyMglBt5T1EE5hOAsX0UOd0IgNtsnKNkpAWM7ILug9M05yiKcKCoxXhKlZ/Q== From: Juri Linkov <juri@HIDDEN> To: scmorris.dev@HIDDEN Subject: Re: bug#80688: [PATCH 1/2] add shell-command-buffer-name-function In-Reply-To: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN> Organization: LINKOV.NET References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN> Date: Wed, 01 Apr 2026 19:03:33 +0300 Message-ID: <875x6azofi.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80688 Cc: 80688 <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 (-) > If non-nil, this variable is called by 'shell-command' with the command > string (trailing '&' already stripped) to generate the output buffer > name, overriding 'shell-command-buffer-name' and > 'shell-command-buffer-name-async'. Both async and synchronous > invocations use the function. I don't know if this is a sufficient replacement, but here is what I do for the same purpose: (add-hook 'shell-command-mode-hook 'rename-uniquely) that renames the buffer afterwards.
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.Received: (at 80688) by debbugs.gnu.org; 31 Mar 2026 19:31:55 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 31 15:31:55 2026 Received: from localhost ([127.0.0.1]:42590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w7eod-0008Ay-2B for submit <at> debbugs.gnu.org; Tue, 31 Mar 2026 15:31:55 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:43069) 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 1w7eoa-0008Ak-B0 for 80688 <at> debbugs.gnu.org; Tue, 31 Mar 2026 15:31:53 -0400 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-b9825ba7f9dso41563866b.0 for <80688 <at> debbugs.gnu.org>; Tue, 31 Mar 2026 12:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774985511; cv=none; d=google.com; s=arc-20240605; b=PA90Be3kuTjs65gr7cupjC3mHNG1h+kXOWRMOTJQWF+kX5Im6shNNT5yPhPxJZ3NNN jK/lw5htLo1JuuAwm1hdyARgsgmFY9WhClUs88ftgoMIc5ql2kyMrT//BYxJ9q4Heyhv AFHH59ResuUvuLZeTesm/zWT0JOjhWlGmc1kbz76fwqgAJrGNEEAbmRepFOtLLBNwyi/ dOPyRG0hXXf0isz667NE7SxCRn0Z9LplGPJBh12EnJDd8o/nWdFjpfuHGF058JTUUC5h piJI5i+TGQqvVxpmUh0157GkV/lKC1a/H2kfAD5jI3YFfAUT0hvtqXOZJkyYXc7YRZ4c Hkhw== 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=n/2zuz+yh33rpaywyHte/gpIUvTp58ifPMb9jUH9xbg=; fh=/LbIeTfDuqN3OJryKYy+l8Vi0omDJjm6C/Vg8use6Wk=; b=acDHtepU9Qpn6G8z/9v6NzxaBOTKQMpHpjzarZ9ALJvzU7rAr6J+HJi3leYZUvW3fx AcYn65nYj38K7tYgmljlOq07hm/S97qlY4hTT8OCtDyoFGFhbAcpFfK7lkM1Fkgwcxz0 nD49OLHqUTYnVHID2i/ARcnaCUgdZ2WBktOxnLwxGGiVZYUfsLAmXa7BVhi4NXqfBu8X 5n5XmGlqWhcU8GMlLYroZTRMrqxuY70bUCveCvhB3C7gv4UgPnONaIIh8tNoWgGsPubB 7y1cmhmyQKZhTfzYfzSiyRPl9wGnk7bggmy0l0hZLuBmD7z4eKr/RMqi4fjKqxR84A+L d8Kw==; 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=1774985511; x=1775590311; 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=n/2zuz+yh33rpaywyHte/gpIUvTp58ifPMb9jUH9xbg=; b=H/gxZCaIQIO3tCzg/wMVkiHHcVz6stN1dm717ciVHXtfEq9yTCTo2Y9mfE8P7e+Qa5 8bLDJcDpqB7tLFny+LmAlYn60C3MOTaLw+EHcj0U2nsj7E4j8OspVgf1LjXp9jXnoJe7 1eufBv+I2RYI2FXShQQABk4OxKabWulycR5o21j8GBpPtV0wyO5khMRTjAF7eQmEO/qM sCmXAHmCVuWEl1waUntijZJ3U2aJNhecIiBZaPKTFyCJxeEG2GQDxD5HVXSM/5gMUvwL XGZWZSTISUEPv0J40wRXD3DRoRhyojdrsPMuTZMImMk/LGkZJ+LxDD4qe692dTo2k00+ qZWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774985511; x=1775590311; 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=n/2zuz+yh33rpaywyHte/gpIUvTp58ifPMb9jUH9xbg=; b=cHivbLE9TicuwQHquuaQGff+VOQxF1dOGILe7MkJNH9V4qNNnPKzsA5Er9rd5ykQnd DYUL+N8WUwSS4LHQG3OuDNcXBS/jl1Aj4gkbou3d1v2SrAiz/nVU0wZPuQRXggRpASPk +GVe3hg5dL7jh92lgLhgonxR5VT3FS/2mDXtZkWVgvK+gEehjX7bSqIBGc2lH1SlfP5l NbzH/gznd4hXWVJGwkxOATxuXyFR5A5ENFBTw+MqQ9M3BHm3dGHhCDTHwv+51abQa39c W+pqprRlJEclW90s+DhddN6bHbQup1/Fc20enuRSS54tyCGu8ZSBy0mGHizTF5YNdaXW o49w== X-Gm-Message-State: AOJu0YyzLBhzO4SjotYDwQu2xzGdiHKHZl4nDwyoZgeNBtXAQG7oPzB6 379Ic8aN+U3l2fTm0uGFdeq7h7Ww5/fTRMM2fmltCCNedMTcJ8QpQwFpXhUuKsw7LX4ZlQbEep0 6K8eaiGzhHRrxrfnUpSW+Rlug9GtzhE4= X-Gm-Gg: ATEYQzxgtsO3VHUIcoTRM+bRV2dn8RPMKg1q86cMwhFnTRx+rqD63UcUjfBnjo8Nix/ jk+hPm9LXGIyxcyjKTRRWSveDjXNvCt8KFjm6NfkMT6TQ5O7MwUm+7449iDk9fJhZijyS2CnqWB WikPN5bFFGLn/K/9EodNt8+0HBHipdx/t7OtC6dlNh9NO77Vx4+tOMtT6oETRTQooPapxTBSY/b uq8aq9esY2a5ZuNI3rWGXFfPf4WmX8nLQWHw3P3+Mz6Ksh2OiKW3RJqD0k9Oz3SWa0epD/nnxoX qVN1BQGR2noPifY6zDicLQ== X-Received: by 2002:a17:907:3d02:b0:b98:8494:3174 with SMTP id a640c23a62f3a-b9be88c483amr287323566b.24.1774985510895; Tue, 31 Mar 2026 12:31:50 -0700 (PDT) MIME-Version: 1.0 References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN> <867bqtqpmc.fsf@HIDDEN> <CAEkeNzj9+HC5Ktn_r_0LgxSG0xLZJeySk=B3tryzEbFn-drFNw@HIDDEN> <86jyuroozm.fsf@HIDDEN> In-Reply-To: <86jyuroozm.fsf@HIDDEN> From: Samuel Morris <scmorris.dev@HIDDEN> Date: Tue, 31 Mar 2026 13:31:39 -0600 X-Gm-Features: AQROBzDv3T2p-hk144dNyqlGKM043BGt3BVIEyAeNDHC5n_Mcwz757wwZjCBAPA Message-ID: <CAEkeNzgnCxO12gEQ=C_fdTZLcODg4gh9RD7p63-G7r4J9RH7gg@HIDDEN> Subject: Re: bug#80688: [PATCH 1/2] add shell-command-buffer-name-function To: Eli Zaretskii <eliz@HIDDEN> Content-Type: multipart/alternative; boundary="000000000000dbc1ae064e570419" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80688 Cc: 80688 <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 (/) --000000000000dbc1ae064e570419 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 31, 2026 at 12:04=E2=80=AFPM Eli Zaretskii <eliz@HIDDEN> wrote= : > > From: Samuel Morris <scmorris.dev@HIDDEN> > > Date: Tue, 31 Mar 2026 09:56:05 -0600 > > Cc: 80688 <at> debbugs.gnu.org > > > > On Mon, Mar 30, 2026 at 9:55=E2=80=AFAM Eli Zaretskii <eliz@HIDDEN> wr= ote: > > > > However, I wonder why do we need to go to such great lengths? How > > about a simple boolean option, by default nil, which, if customized to > > a non-nil value, will cause shell-command to create a buffer whose > > name is the command string? > > > > For my use case, each unique invocation of a command needs to have its > > own buffer. So if you typed ls, followed by ls, if the buffer were > > just named after the command, then the output would be overwritten, > > no? > > Not necessarily, Emacs can generate unique names for the same basic > string. > > > I suppose there are some ways to ensure the name is unique, like > > adding a timestamp or using (rename-uniquely), or maybe something > > else. > > Yes. > > > The broader idea here is to emulate a shell, but rather than > > concatenating commands together with their output, they are all > > separated, separately searchable and saveable, and potentially each > > having its own major-mode. More abstractly I was thinking of > > shell-command-buffer-name-functions along the same lines as the PS1 > > environment variable. I figured different users/packages might want > > things to look one way or another. > > Sorry, I don't follow: how is this relevant to the issue of naming the > buffer? > My thinking was, for example, say you have a list of buffers, all named after your shell command. Do you include a timestamp, if so, what format? How about the current working directory of that command? Why not the prompt itself? PS1 has similar fields for command meta-data. So you can imagine you might want a view like this to browse your buffers: 1:2:34 >> ls -l 1:2:35 >> journalctl --full 1:2:35 >> cat foo Though, come to think of it, perhaps another better way to do that would be to modify annotation-function or affixation-function in the completion variables for the command for browsing those particular buffers. I already prepend my package name to each command, mainly for easy buffer-display-alist customization. But I suppose I could access the buffer-local variables instead and customize display based on my minor-mode. In that case, I wonder if I can just not display the built-in buffer name at all, and use whatever I want. I=E2=80=99m not entir= ely sure if that=E2=80=99s possible, but in that case, the buffer name is irrelevant, as long as it is unique. > > > So yeah, generally, I had extension in mind, and this seemed like the > > most flexible way to get that without imposing my niche way of doing > > things on everyone else. And I wanted to prevent other users from > > getting into the same situation, where they need to rewrite their own > > version of a very complex function like shell-command to get the > > behavior they want. This certainly would remove a lot of maintenance > > burden for me. > > So would my suggestion of having just a single boolean option. Given > that until now we had just a single fixed name of the buffer, I think > it's prudent to start with a small step, instead of jumping all the > way to a custom function. As a nice bonus, under my proposal, > customizing this behavior will be much easier for users who want that, > since writing a full-fledged Lisp function is not necessarily easy for > everyone who uses shell-command. > > WDYT? > Yes, I think that would work for me for now. Though I'll just add, I could add that boolean to a default custom function, then we get the best of both worlds, an easy switch to turn on naming buffers after commands, and a full customizable function for users who want more extreme customization. But I can work with either option, whatever you think is best after all that information. --000000000000dbc1ae064e570419 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">On Tue, Mar 31, 2026 at 12:04=E2=80=AFPM = Eli Zaretskii <<a href=3D"mailto:eliz@HIDDEN">eliz@HIDDEN</a>> 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">> From: Samuel Morris <<a href=3D"ma= ilto:scmorris.dev@HIDDEN" target=3D"_blank">scmorris.dev@HIDDEN</a>&g= t;<br> > Date: Tue, 31 Mar 2026 09:56:05 -0600<br> > Cc: <a href=3D"mailto:80688 <at> debbugs.gnu.org" target=3D"_blank">80688@d= ebbugs.gnu.org</a><br> > <br> > On Mon, Mar 30, 2026 at 9:55=E2=80=AFAM Eli Zaretskii <<a href=3D"m= ailto:eliz@HIDDEN" target=3D"_blank">eliz@HIDDEN</a>> wrote:<br> > <br> >=C2=A0 However, I wonder why do we need to go to such great lengths?=C2= =A0 How<br> >=C2=A0 about a simple boolean option, by default nil, which, if customi= zed to<br> >=C2=A0 a non-nil value, will cause shell-command to create a buffer who= se<br> >=C2=A0 name is the command string?<br> > <br> > For my use case, each unique invocation of a command needs to have its= <br> > own buffer. So if you typed ls, followed by ls, if the buffer were<br> > just named after the command, then the output would be overwritten,<br= > > no?<br> <br> Not necessarily, Emacs can generate unique names for the same basic<br> string.<br> <br> > I suppose there are some ways to ensure the name is unique, like<br> > adding a timestamp or using (rename-uniquely), or maybe something<br> > else.<br> <br> Yes.<br> <br> > The broader idea here is to emulate a shell, but rather than<br> > concatenating commands together with their output, they are all<br> > separated, separately searchable and saveable, and potentially each<br= > > having its own major-mode. More abstractly I was thinking of<br> > shell-command-buffer-name-functions along the same lines as the PS1<br= > > environment variable. I figured different users/packages might want<br= > > things to look one way or another.<br> <br> Sorry, I don't follow: how is this relevant to the issue of naming the<= br> buffer?<br></blockquote><div><br></div><div>My thinking was, for example, s= ay you have a list of buffers, all<br>named after your shell command. Do yo= u include a timestamp, if so,<br>what format? How about the current working= directory of that command?<br>Why not the prompt itself? PS1 has similar f= ields for command<br>meta-data. So you can imagine you might want a view li= ke this to<br>browse your buffers:<br><br>1:2:34 >> ls -l<br>1:2:35 &= gt;> journalctl --full<br>1:2:35 >> cat foo<br><br>Though, come to= think of it, perhaps another better way to do that<br>would be to modify a= nnotation-function or affixation-function in the<br>completion variables fo= r the command for browsing those particular<br>buffers. I already prepend m= y package name to each command, mainly for<br>easy buffer-display-alist cus= tomization. But I suppose I could access<br>the buffer-local variables inst= ead and customize display based on my<br>minor-mode. In that case, I wonder= if I can just not display the<br>built-in buffer name at all, and use what= ever I want. I=E2=80=99m not entirely<br>sure if that=E2=80=99s possible, b= ut in that case, the buffer name is<br>irrelevant, as long as it is unique.= <br>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0= px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br> > So yeah, generally, I had extension in mind, and this seemed like the<= br> > most flexible way to get that without imposing my niche way of doing<b= r> > things on everyone else. And I wanted to prevent other users from<br> > getting into the same situation, where they need to rewrite their own<= br> > version of a very complex function like shell-command to get the<br> > behavior they want. This certainly would remove a lot of maintenance<b= r> > burden for me.<br> <br> So would my suggestion of having just a single boolean option.=C2=A0 Given<= br> that until now we had just a single fixed name of the buffer, I think<br> it's prudent to start with a small step, instead of jumping all the<br> way to a custom function.=C2=A0 As a nice bonus, under my proposal,<br> customizing this behavior will be much easier for users who want that,<br> since writing a full-fledged Lisp function is not necessarily easy for<br> everyone who uses shell-command.<br> <br> WDYT?<br></blockquote><div><br></div><div>Yes, I think that would work for = me for now. Though I'll just add, I<br>could add that boolean to a defa= ult custom function, then we get the<br>best of both worlds, an easy switch= to turn on naming buffers after<br>commands, and a full customizable funct= ion for users who want more<br>extreme customization. But I can work with e= ither option, whatever you<br>think is best after all that information.</di= v></div></div> --000000000000dbc1ae064e570419--
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.Received: (at 80688) by debbugs.gnu.org; 31 Mar 2026 18:04:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 31 14:04:17 2026 Received: from localhost ([127.0.0.1]:41567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w7dRn-0000IW-HC for submit <at> debbugs.gnu.org; Tue, 31 Mar 2026 14:04:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58790) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1w7dRj-0000Gt-49 for 80688 <at> debbugs.gnu.org; Tue, 31 Mar 2026 14:04:13 -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 1w7dRd-0002uS-I4; Tue, 31 Mar 2026 14:04:05 -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=5P/F4LHWW47fb0/K8Ll63bRNwFVhsZZwxbUBn4K1hvU=; b=ndhn+VHwckU3vJSnmkFs yHR8w51z4rn0dgIC8tQTONsxnDpi/4atOPKBYgTXEjiJoQVcBZMWy4kv9cbBx+l6bNZ7iCvPR2oI7 cob5ecNgikAYPSVOhLuGFbe8u1AsXMZFep0RfqUr7zT/VCDJCj2GSI+admazEScO7apIxtN+Mxotn sHfofDESVr4NcpmzoWIhwEzs4KFq6GYEX3X7nWQL6liukhieI5dflx8xhnsDt1Ov6Y9ZuG/HbZ284 PPeLZoc/URuSqWL4mhSYzkLuYboobRMOTVN3mxo6GlQFouatqUwa1MWhqGVcPkWcpZK9RxCLHUDtP QiemdeEJaY/oVg==; Date: Tue, 31 Mar 2026 21:03:41 +0300 Message-Id: <86jyuroozm.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Samuel Morris <scmorris.dev@HIDDEN> In-Reply-To: <CAEkeNzj9+HC5Ktn_r_0LgxSG0xLZJeySk=B3tryzEbFn-drFNw@HIDDEN> (message from Samuel Morris on Tue, 31 Mar 2026 09:56:05 -0600) Subject: Re: bug#80688: [PATCH 1/2] add shell-command-buffer-name-function References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN> <867bqtqpmc.fsf@HIDDEN> <CAEkeNzj9+HC5Ktn_r_0LgxSG0xLZJeySk=B3tryzEbFn-drFNw@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: 80688 Cc: 80688 <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 09:56:05 -0600 > Cc: 80688 <at> debbugs.gnu.org > > On Mon, Mar 30, 2026 at 9:55 AM Eli Zaretskii <eliz@HIDDEN> wrote: > > However, I wonder why do we need to go to such great lengths? How > about a simple boolean option, by default nil, which, if customized to > a non-nil value, will cause shell-command to create a buffer whose > name is the command string? > > For my use case, each unique invocation of a command needs to have its > own buffer. So if you typed ls, followed by ls, if the buffer were > just named after the command, then the output would be overwritten, > no? Not necessarily, Emacs can generate unique names for the same basic string. > I suppose there are some ways to ensure the name is unique, like > adding a timestamp or using (rename-uniquely), or maybe something > else. Yes. > The broader idea here is to emulate a shell, but rather than > concatenating commands together with their output, they are all > separated, separately searchable and saveable, and potentially each > having its own major-mode. More abstractly I was thinking of > shell-command-buffer-name-functions along the same lines as the PS1 > environment variable. I figured different users/packages might want > things to look one way or another. Sorry, I don't follow: how is this relevant to the issue of naming the buffer? > So yeah, generally, I had extension in mind, and this seemed like the > most flexible way to get that without imposing my niche way of doing > things on everyone else. And I wanted to prevent other users from > getting into the same situation, where they need to rewrite their own > version of a very complex function like shell-command to get the > behavior they want. This certainly would remove a lot of maintenance > burden for me. So would my suggestion of having just a single boolean option. Given that until now we had just a single fixed name of the buffer, I think it's prudent to start with a small step, instead of jumping all the way to a custom function. As a nice bonus, under my proposal, customizing this behavior will be much easier for users who want that, since writing a full-fledged Lisp function is not necessarily easy for everyone who uses shell-command. WDYT?
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.Received: (at 80688) by debbugs.gnu.org; 31 Mar 2026 17:52:49 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 31 13:52:48 2026 Received: from localhost ([127.0.0.1]:41352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w7dGd-0007Kh-TO for submit <at> debbugs.gnu.org; Tue, 31 Mar 2026 13:52:48 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]:59678) 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 1w7dGZ-0007KC-Qq for 80688 <at> debbugs.gnu.org; Tue, 31 Mar 2026 13:52:41 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-b982d56dac4so1023741366b.3 for <80688 <at> debbugs.gnu.org>; Tue, 31 Mar 2026 10:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774979558; cv=none; d=google.com; s=arc-20240605; b=Vl4CbxFJg9/fts60RrWJA6FQRbqIMwrwTvnegwBPIqwiyzedV5eSVScrCGQhyY9FJ2 VwdwLjOJboIaM0VRPtUmACGX/L8l9GWNdCGWgaLYRSfANC38PS8YLQyXTTE1PGEfSmcU xrlX6g0bsgnGpl5emNOaoecBVeL/U5VeF0m6Amdt5gZ5WHYkZpJiGfiEEMGidn6Rwy+a T73YPRsAY/hdhOJG3Z8tgSczJAsP/SY9zCC8QRRbUKSTzAflzaIJDERM7yDl4Zd85GtX +RoDZO6TU2BKD1cv4LhtEWEHBLVtCuG6AMs7ty63aZ/ufi6lSsS1oxZZTkX0VAZTmgto Q0aw== 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=qvc8N561nww8ScXnGSq8FXrJQVePa7UbiD+0cQk2hHs=; fh=vVm+vxO7GMkqoE0WXHvDl6B/VkQCawCUElMF46gm+C4=; b=hoAsvYsdY1BlrCM4xLdKN2JGQDkos+F0nBHA83fTaEsagv7M86FL73kLKxKT62fBR0 XCR9bqlgI/lUPqrIPDpmXmM44bQhfwfUGqwHUpU6JQdGCoecnM4qFvc/QCY2IgH2s8x1 +3/JiLxLPjn8sC6hUFFfNsWfiY+DSk46Xa7ZO0ycg0rzupkb0gVRzsXMd7RrekIeQd8P So2klkw9x+Sa4uAynqFU547fZpmFgPKUVvBl+q+KmuJkxj8rpGiC+tAlVWYPfHR/sLv7 XZ9y29WBd/8jdokZHPemfb+5ay53gnO5FueP4ypWRbjdpLGkj17/fNIKKeFiqv+0aqJ2 q+/A==; 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=1774979558; x=1775584358; 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=qvc8N561nww8ScXnGSq8FXrJQVePa7UbiD+0cQk2hHs=; b=BqNZDmM84m0AyyohwjHcdjJ3f2zfLZcQKepGFP4x4166nMZhHRQrGrJRqj8vAcOzMs ihaEYeMcNn2dH/Ea5O7+qlP91yCDyLlNCzcZ+oRdwFWmcY9+aNnJYWNWWf2Mqu7kCVQH O3xuBq3egQDIpO04BkqlgGQLvGNyLsJ7ynkpwosWvLqmYxRYPtraNtthzym28V6lNpFj vsn4Gk0aWHGH2SpPtB1A4Fu84QWuS7/K+XnFgOXUC8sBD1MnUUJxFkqZZN8PG7J4IXOe lE1qQopvA1D75IazS+5DiMLtFL8F6xmNiMua8i4WOKPe/Uoneh43YJpqj2sVxNF91Msv b/RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774979558; x=1775584358; 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=qvc8N561nww8ScXnGSq8FXrJQVePa7UbiD+0cQk2hHs=; b=cjqDtYDVPZe3BRo/zxuUjVPLlh5JnLA4FuDlYjLLaLkG3xom3UtwO5Nt/pjrX+C1MJ 8a4wWcEGTG8nKMlU+eiXqmM79hnWrS5Lj9buTdrgtCeIr4XJleWHylzuNzIs4t/ajQgB RSuo6L0csKdLsSF5xjTsRmwKj7DNwpXW4/Do0a8cSOKwABce4HR9lSS+kmvO2X+ZD18B LZaf2Ph16hGGKHAnqGKcb1+6WVE2FVeQjSfliFSlYFcWO4mcGpBVjII7bDDFRrQMv6xp 5yat3redXUyRN6Vs/IgJwEMZ7TEt6hcY1oX4qKZs//+GTZeZL34FiPiQ8OGmo7h9aKw1 tJiw== X-Forwarded-Encrypted: i=1; AJvYcCVCZfm+UBnn3j6fRWPOKxpLoxQvnhs1FCdKI/eLtgnQdulSdTh9DQoIQ7cdesbq2wKQWvVR8g==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwIAo3Xb/z2xLYq6/UeCp35UTcroQqEioittkDuKzDop3eCpfPR +6O5glR/x8FxEYXJZTayGSU5LfNoN6vOEgAEgCby5b/zMN3dFsZYMHI+sIjDg+hzadVtUvuM5uk BKYToeid1268rbAyRwzFKX2PlJd1UmNw= X-Gm-Gg: ATEYQzxgXIGKJmBX4yr5Pe+aOyHJmDqsEphkhxiXa6gbNwww4C8/NbeORDCpkEdjOLs 96jCGyZ64qnjNeelI2LxdcIJ10JAzvkO1Be8UNrxHwsBNM2NU76IonUqoYXLDT6NJiOCZopNUb/ Z3bFlg9T6XOr4B6xUwOK5GCOHgGksQ/C49KUXlmcVTTV4f5khZoh/HH9pLiwxZiCnoaoM2JTjKE q4T1Pl9MaqCEwxqOBfETahXmB6orN87mfudXFUERCKt7pWl8TOX1GDlThibY9Sywvn5dhQYyzCX XlW7 X-Received: by 2002:a17:907:3895:b0:b98:13a:c92e with SMTP id a640c23a62f3a-b9c1379a41bmr42917566b.2.1774979558138; Tue, 31 Mar 2026 10:52:38 -0700 (PDT) MIME-Version: 1.0 References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN> <867bqtqpmc.fsf@HIDDEN> <CAEkeNzj9+HC5Ktn_r_0LgxSG0xLZJeySk=B3tryzEbFn-drFNw@HIDDEN> <CAN+1HbpGBEz0HyYC21he=QEsAd21Cp2DhgfYvwiVTiRftPEMGQ@HIDDEN> In-Reply-To: <CAN+1HbpGBEz0HyYC21he=QEsAd21Cp2DhgfYvwiVTiRftPEMGQ@HIDDEN> From: Samuel Morris <scmorris.dev@HIDDEN> Date: Tue, 31 Mar 2026 11:52:26 -0600 X-Gm-Features: AQROBzBU4-5oDbYybr9qBTAMa_Y1QIJmcHOFBY3Fkt4J8gRMzl7QtXN9eSzOc_E Message-ID: <CAEkeNzgFH88Br0-1FOr-bJ=u9b+tOKBnScCHx85ED_rzyH+_iA@HIDDEN> Subject: Re: bug#80688: [PATCH 1/2] add shell-command-buffer-name-function To: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN> Content-Type: multipart/alternative; boundary="0000000000000be475064e55a2eb" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80688 Cc: 80688 <at> debbugs.gnu.org, Eli Zaretskii <eliz@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 (/) --0000000000000be475064e55a2eb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 31, 2026 at 10:08=E2=80=AFAM St=C3=A9phane Marks <shipmints@gma= il.com> wrote: > On Tue, Mar 31, 2026 at 11:57=E2=80=AFAM Samuel Morris <scmorris.dev@gmai= l.com> > wrote: > >> On Mon, Mar 30, 2026 at 9:55=E2=80=AFAM Eli Zaretskii <eliz@HIDDEN> wro= te: >> >>> > Cc: "S.C. Morris" <scmorris.dev@HIDDEN> >>> > From: scmorris.dev@HIDDEN >>> > Date: Sun, 29 Mar 2026 16:48:39 -0600 >>> > >>> > From: "S.C. Morris" <scmorris.dev@HIDDEN> >>> > >>> > If non-nil, this variable is called by 'shell-command' with the comma= nd >>> > string (trailing '&' already stripped) to generate the output buffer >>> > name, overriding 'shell-command-buffer-name' and >>> > 'shell-command-buffer-name-async'. Both async and synchronous >>> > invocations use the function. >>> > >>> > * lisp/simple.el (shell-command-buffer-name-function): New defvar. >>> > (shell-command): Use it when computing the output buffer name. >>> > Document it in the docstring. >>> >>> Thanks. >>> >>> However, I wonder why do we need to go to such great lengths? How >>> about a simple boolean option, by default nil, which, if customized to >>> a non-nil value, will cause shell-command to create a buffer whose >>> name is the command string? >>> >> >> For my use case, each unique invocation of a command needs to have its >> own buffer. So if you typed ls, followed by ls, if the buffer were >> just named after the command, then the output would be overwritten, >> no? I suppose there are some ways to ensure the name is unique, like >> adding a timestamp or using (rename-uniquely), or maybe something >> else. The broader idea here is to emulate a shell, but rather than >> concatenating commands together with their output, they are all >> separated, separately searchable and saveable, and potentially each >> having its own major-mode. More abstractly I was thinking of >> shell-command-buffer-name-functions along the same lines as the PS1 >> environment variable. I figured different users/packages might want >> things to look one way or another. >> >> So yeah, generally, I had extension in mind, and this seemed like the >> most flexible way to get that without imposing my niche way of doing >> things on everyone else. And I wanted to prevent other users from >> getting into the same situation, where they need to rewrite their own >> version of a very complex function like shell-command to get the >> behavior they want. This certainly would remove a lot of maintenance >> burden for me. >> > > Maybe an eshell pipe contortion would work instead of using shell? If it > must be shell, could a new function be created instead of overloading the > existing one perhaps named shell-command-to-buffer and it could default t= o > a sensible buffer (current or otherwise) and allow specifying a name or a > function that generates a name from the command string? > I am guessing here that you are very hesitant to modify, or in any way encourage the modification of a command that is used by many packages and internals. I think I could create another command like shell-command-to-buffer. I expect it would duplicate a lot of the code from shell-command, unless I refactored the common parts, which I would be willing to do if that was desired. The purpose of my package in the first place was to enhance the shell-command interface, so if that means creating a cleaner, more flexible parallel interface upstream, with less legacy downstream dependencies, then I would be okay with that. --0000000000000be475064e55a2eb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">On Tue, Mar 31, 2026 at 10:08=E2=80=AFAM = St=C3=A9phane Marks <<a href=3D"mailto:shipmints@HIDDEN">shipmints@gm= ail.com</a>> wrote:</div><div class=3D"gmail_quote gmail_quote_container= "><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;borde= r-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div d= ir=3D"ltr"><div style=3D"font-family:monospace"><span style=3D"font-family:= Arial,Helvetica,sans-serif">On Tue, Mar 31, 2026 at 11:57=E2=80=AFAM Samuel= Morris <<a href=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scm= orris.dev@HIDDEN</a>> wrote:</span></div></div><div class=3D"gmail_qu= ote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo= rder-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><di= v dir=3D"ltr">On Mon, Mar 30, 2026 at 9:55=E2=80=AFAM Eli Zaretskii <<a = href=3D"mailto:eliz@HIDDEN" target=3D"_blank">eliz@HIDDEN</a>> wrote:<= /div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"= margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-lef= t:1ex">> Cc: "S.C. Morris" <<a href=3D"mailto:scmorris.dev@= gmail.com" target=3D"_blank">scmorris.dev@HIDDEN</a>><br> > From: <a href=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmo= rris.dev@HIDDEN</a><br> > Date: Sun, 29 Mar 2026 16:48:39 -0600<br> > <br> > From: "S.C. Morris" <<a href=3D"mailto:scmorris.dev@gmail= .com" target=3D"_blank">scmorris.dev@HIDDEN</a>><br> > <br> > If non-nil, this variable is called by 'shell-command' with th= e command<br> > string (trailing '&' already stripped) to generate the out= put buffer<br> > name, overriding 'shell-command-buffer-name' and<br> > 'shell-command-buffer-name-async'.=C2=A0 Both async and synchr= onous<br> > invocations use the function.<br> > <br> > * lisp/simple.el (shell-command-buffer-name-function): New defvar.<br> > (shell-command): Use it when computing the output buffer name.<br> > Document it in the docstring.<br> <br> Thanks.<br> <br> However, I wonder why do we need to go to such great lengths?=C2=A0 How<br> about a simple boolean option, by default nil, which, if customized to<br> a non-nil value, will cause shell-command to create a buffer whose<br> name is the command string?<br></blockquote><div><br></div>For my use case,= each unique invocation of a command needs to have its<br>own buffer. So if= you typed ls, followed by ls, if the buffer were<br>just named after the c= ommand, then the output would be overwritten,<br>no? I suppose there are so= me ways to ensure the name is unique, like<br>adding a timestamp or using (= rename-uniquely), or maybe something<br>else. The broader idea here is to e= mulate a shell, but rather than<br>concatenating commands together with the= ir output, they are all<br>separated, separately searchable and saveable, a= nd potentially each<br>having its own major-mode. More abstractly I was thi= nking of<br>shell-command-buffer-name-functions along the same lines as the= PS1<br>environment variable. I figured different users/packages might want= <br>things to look one way or another.<br><br>So yeah, generally, I had ext= ension in mind, and this seemed like the<br>most flexible way to get that w= ithout imposing my niche way of doing<br>things on everyone else. And I wan= ted to prevent other users from<br>getting into the same situation, where t= hey need to rewrite their own<br>version of a very complex function like sh= ell-command to get the<br>behavior they want. This certainly would remove a= lot of maintenance<br>burden for me.</div></div></blockquote><div><br></di= v><div style=3D"font-family:monospace">Maybe an eshell pipe contortion woul= d work instead of using shell?=C2=A0 If it must be shell, could a new funct= ion be created instead of overloading the existing one perhaps named shell-= command-to-buffer and it could default to a sensible buffer (current or oth= erwise) and allow specifying a name or a function that generates a name fro= m the command string?</div></div></div></blockquote><div><br></div><div>I a= m guessing here that you are very hesitant to modify, or in any way<br>enco= urage the modification of a command that is used by many packages<br>and in= ternals. I think I could create another command like<br>shell-command-to-bu= ffer. I expect it would duplicate a lot of the code<br>from shell-command, = unless I refactored the common parts, which I<br>would be willing to do if = that was desired. The purpose of my package<br>in the first place was to en= hance the shell-command interface, so if<br>that means creating a cleaner, = more flexible parallel interface<br>upstream, with less legacy downstream d= ependencies, then I would be<br>okay with that.</div></div></div> --0000000000000be475064e55a2eb--
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.
Received: (at 80688) by debbugs.gnu.org; 31 Mar 2026 16:08:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 31 12:08:43 2026
Received: from localhost ([127.0.0.1]:39710 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1w7bdy-00028V-RT
for submit <at> debbugs.gnu.org; Tue, 31 Mar 2026 12:08:43 -0400
Received: from mail-ua1-x92f.google.com ([2607:f8b0:4864:20::92f]:44313)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
id 1w7bdv-00028N-NT
for 80688 <at> debbugs.gnu.org; Tue, 31 Mar 2026 12:08:40 -0400
Received: by mail-ua1-x92f.google.com with SMTP id
a1e0cc1a2514c-953af2af419so779156241.1
for <80688 <at> debbugs.gnu.org>; Tue, 31 Mar 2026 09:08:39 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1774973319; cv=none;
d=google.com; s=arc-20240605;
b=gfjPPMyS7YjO6F1lbQkHHn7HQ+H0U3l7/AH9h4DfkI6RWjQJiXCVXTaIhA1qJ1T/Y9
7c1AuTvlK87CpANGh3veTUtfh+9LIv9Jj8vZRQ65VlKUG4N/tkxUv/FJdegCvzqi0U/c
Rz/4u4u9p4obGOsg4157rRNINuBKTh0OMAm6rWS2AH1zMzTuh+ioH2AnORNJdqrhph6w
tUvinV4eKjtJYvZeeEPJ+OitzEfECeUnFxNkYyWq5jtrlqSUZHThCRsf6OUbr4S0zneW
HUDxBWFyxfYlFOiFIyWotlIQfcnVcLYx1/nylJ6ThlypIurvtZFD79fK5q/I6F+mao1q
H6bQ==
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=XAymhuM801riE1HH5sTla92Nm+LBem/q9vWIyL5uyhM=;
fh=QgYKGrtW8yWBk5stKaGGOQWYMfTG/FCPbkVNzYf4vss=;
b=imKROd60iHkvA5Y9RzUyZ1i74Ex1RX1Gevab8HaX+bFRnGkf3vVelz4Oh8OqRdqa18
sL8w9I2YquM35GT8bY/IAOgwT7lBzE3gARTCvhK+dJJyfomciXZ4tBhilD3igj5i7hFq
WQfc5xY4cy0KPKP7ZBiqiIXmA0lTtQKAEn2NIPQD2z/vlbSvyq3KTXUhMN9SJhRMYXIK
0SWhMSanETB7o4nVx2yTksFOsu3Rq5+ar5qZB2XJrTKjUdkC2r4wNDnWtULoW8FPNesI
zo+EQ0Mxw3+DSOal6UG78haK/MPwZDH0Kw/5KV4Fd0zWaM/BGEWJzH0WqL4ofuHZURPa
4mMw==; 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=1774973319; x=1775578119; 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=XAymhuM801riE1HH5sTla92Nm+LBem/q9vWIyL5uyhM=;
b=SMLAiuBE9AMESJIyBmvNF10vag3k52X+FUvs0HuN03RIQNCuzNTP44ACtTObGknmaI
huVM2KjCsDy6N17IVFbM5Om54k9l8oK2VC4uxDKLWI/GQn65ugLHvrLZH0QAYNmUjQvY
QWPrmbgrf8mYPwpaoaJefaV3FIQwa1X6Keeh6Ds441IEUYouwcxE4g1xS4zfoUVUmmdM
LNFGHGI6fswyNjcE0oJL/sCrMeiQ4/2RsUq5uSykYhxRdAAWXLVisVGRqjpxuK+KkhSr
TvVLRMTwPl+GUMs9VeKzcp5VkjTF6+umtJWcyV5wAwP+9OeT2kTgMFVmsaI6VQwhGwjJ
91Tw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1774973319; x=1775578119;
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=XAymhuM801riE1HH5sTla92Nm+LBem/q9vWIyL5uyhM=;
b=F/MRHG8fVLLvEXQIZUXjKWsWwkWoOZlTdwXcnAu7Cb0fExEDpN/Cufu0rBXiY7BANY
bAUkNYgusDfB61acfCi8F9/SXuYDMGKLm/IJ4U0oZhKCx6akjO747V0MzJz026z309YI
/v2SZCVYRCofnGu0xWF7Ru1O7pqTjlAvy3verzmXQCyD4dPBUVyizNF44F2hU3zPvkkh
leNboPSD093jlpuq9hAVOU9jJjDIVrs1ukBYdpYkjs2oE8bfPGVmERUavpZOHFdxFI3C
hXBRurp/eFjIXsUsrETUcSfwFYHysk1HgxU5lM88d0+5pbhJQYAcZeyiVURiPD0Vlk35
/Few==
X-Forwarded-Encrypted: i=1;
AJvYcCUbzCbDIeuGV7R3W5D2mOvjmKG9pOrF5zQ3uBMy4IIlcADyDVMBrVxdjnsQYig/WvYXiV+oDQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxESnupp8T8+pWP48L1m7DFjm/6+3/Ffsj2JxkBKNn5cdvUjkjb
RPRVzaPO2XAOrQD+UeChaAlRnYtyMIPcej4mHKt+zF50sn8f0BGqE3kTXw8kBbtzFF83PYMKnWZ
yY+W6hUB341aMsN8njMLg1HXXiRQzFOQ=
X-Gm-Gg: ATEYQzy32AocwoqD9T6+4plhVRvLO2XoiNoTlgqdk3LHrbo/+0LZfCiDjAY3CB3D8Le
ViiA29Tc32G48CRiASqXscOecZXXdPfIqmsvsJ/hXPIv/Hm5BRr5p1ViAPo+IJYocr3HJtlH3nq
l+vzYuCazntrrWxi3xgW+/WKVUUTh343kQOPxyz9vb9GlZS8NnfkmZzyU0KMq8ZhtPfvDZmiXnU
fXR0tNm9oHIOUv+/Xb40QySmSxs8JItARZ2T6wz2VA9E0TeCsJhllSal1r1F+Gst/TOm5Vj0h2i
vKKXnmBevsD63WtvT1J1yonGrmMa+okRpYKwcTSKFwlp7S1SV48SWeFRdDBf2QQ=
X-Received: by 2002:a05:6102:149b:b0:5ff:b684:f796 with SMTP id
ada2fe7eead31-604f90e1c2fmr5921201137.13.1774973318891; Tue, 31 Mar 2026
09:08:38 -0700 (PDT)
MIME-Version: 1.0
References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
<867bqtqpmc.fsf@HIDDEN>
<CAEkeNzj9+HC5Ktn_r_0LgxSG0xLZJeySk=B3tryzEbFn-drFNw@HIDDEN>
In-Reply-To: <CAEkeNzj9+HC5Ktn_r_0LgxSG0xLZJeySk=B3tryzEbFn-drFNw@HIDDEN>
From: =?UTF-8?Q?St=C3=A9phane_Marks?= <shipmints@HIDDEN>
Date: Tue, 31 Mar 2026 12:08:27 -0400
X-Gm-Features: AQROBzBVeDX7YljqLyvjFcLMg0sOzFTs9HjPWHPg7p7O9ST2j4BJ17kunsmrbmI
Message-ID: <CAN+1HbpGBEz0HyYC21he=QEsAd21Cp2DhgfYvwiVTiRftPEMGQ@HIDDEN>
Subject: Re: bug#80688: [PATCH 1/2] add shell-command-buffer-name-function
To: Samuel Morris <scmorris.dev@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000288a5c064e542e2e"
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: On Tue, Mar 31, 2026 at 11:57 AM Samuel Morris wrote: >
On Mon, Mar 30, 2026 at 9:55 AM Eli Zaretskii wrote: > >> > Cc: "S.C. Morris"
>> > From: scmorris.dev@HIDDEN >> > Date: Sun, 29 Mar 2026 16:48:39 -0600
>> > >> > From: "S.C. Morris" >> > [...]
Content analysis details: (2.0 points, 10.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
provider (shipmints[at]gmail.com)
0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
1.0 FORGED_GMAIL_RCVD 'From' gmail.com does not match 'Received'
headers
-0.0 SPF_PASS SPF: sender matches SPF record
-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/,
no trust
[2607:f8b0:4864:20:0:0:0:92f listed in]
[list.dnswl.org]
0.0 HTML_MESSAGE BODY: HTML included in message
1.0 FREEMAIL_REPLY From and body contain different freemails
X-Debbugs-Envelope-To: 80688
Cc: 80688 <at> debbugs.gnu.org, Eli Zaretskii <eliz@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 (/)
--000000000000288a5c064e542e2e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Tue, Mar 31, 2026 at 11:57=E2=80=AFAM Samuel Morris <scmorris.dev@gmail.=
com>
wrote:
> On Mon, Mar 30, 2026 at 9:55=E2=80=AFAM Eli Zaretskii <eliz@HIDDEN> wrot=
e:
>
>> > Cc: "S.C. Morris" <scmorris.dev@HIDDEN>
>> > From: scmorris.dev@HIDDEN
>> > Date: Sun, 29 Mar 2026 16:48:39 -0600
>> >
>> > From: "S.C. Morris" <scmorris.dev@HIDDEN>
>> >
>> > If non-nil, this variable is called by 'shell-command' with the comman=
d
>> > string (trailing '&' already stripped) to generate the output buffer
>> > name, overriding 'shell-command-buffer-name' and
>> > 'shell-command-buffer-name-async'. Both async and synchronous
>> > invocations use the function.
>> >
>> > * lisp/simple.el (shell-command-buffer-name-function): New defvar.
>> > (shell-command): Use it when computing the output buffer name.
>> > Document it in the docstring.
>>
>> Thanks.
>>
>> However, I wonder why do we need to go to such great lengths? How
>> about a simple boolean option, by default nil, which, if customized to
>> a non-nil value, will cause shell-command to create a buffer whose
>> name is the command string?
>>
>
> For my use case, each unique invocation of a command needs to have its
> own buffer. So if you typed ls, followed by ls, if the buffer were
> just named after the command, then the output would be overwritten,
> no? I suppose there are some ways to ensure the name is unique, like
> adding a timestamp or using (rename-uniquely), or maybe something
> else. The broader idea here is to emulate a shell, but rather than
> concatenating commands together with their output, they are all
> separated, separately searchable and saveable, and potentially each
> having its own major-mode. More abstractly I was thinking of
> shell-command-buffer-name-functions along the same lines as the PS1
> environment variable. I figured different users/packages might want
> things to look one way or another.
>
> So yeah, generally, I had extension in mind, and this seemed like the
> most flexible way to get that without imposing my niche way of doing
> things on everyone else. And I wanted to prevent other users from
> getting into the same situation, where they need to rewrite their own
> version of a very complex function like shell-command to get the
> behavior they want. This certainly would remove a lot of maintenance
> burden for me.
>
Maybe an eshell pipe contortion would work instead of using shell? If it
must be shell, could a new function be created instead of overloading the
existing one perhaps named shell-command-to-buffer and it could default to
a sensible buffer (current or otherwise) and allow specifying a name or a
function that generates a name from the command string?
--000000000000288a5c064e542e2e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Tue, Mar 31, 2026 at 11:57=E2=80=AFAM Samuel Morris <<a href=3D"mailt=
o:scmorris.dev@HIDDEN">scmorris.dev@HIDDEN</a>> wrote:</span></div=
></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"><div dir=3D"ltr"><div dir=3D"ltr">On Mon, =
Mar 30, 2026 at 9:55=E2=80=AFAM Eli Zaretskii <<a href=3D"mailto:eliz@gn=
u.org" target=3D"_blank">eliz@HIDDEN</a>> wrote:</div><div class=3D"gma=
il_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Cc: "=
S.C. Morris" <<a href=3D"mailto:scmorris.dev@HIDDEN" target=3D"_=
blank">scmorris.dev@HIDDEN</a>><br>
> From: <a href=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmo=
rris.dev@HIDDEN</a><br>
> Date: Sun, 29 Mar 2026 16:48:39 -0600<br>
> <br>
> From: "S.C. Morris" <<a href=3D"mailto:scmorris.dev@gmail=
.com" target=3D"_blank">scmorris.dev@HIDDEN</a>><br>
> <br>
> If non-nil, this variable is called by 'shell-command' with th=
e command<br>
> string (trailing '&' already stripped) to generate the out=
put buffer<br>
> name, overriding 'shell-command-buffer-name' and<br>
> 'shell-command-buffer-name-async'.=C2=A0 Both async and synchr=
onous<br>
> invocations use the function.<br>
> <br>
> * lisp/simple.el (shell-command-buffer-name-function): New defvar.<br>
> (shell-command): Use it when computing the output buffer name.<br>
> Document it in the docstring.<br>
<br>
Thanks.<br>
<br>
However, I wonder why do we need to go to such great lengths?=C2=A0 How<br>
about a simple boolean option, by default nil, which, if customized to<br>
a non-nil value, will cause shell-command to create a buffer whose<br>
name is the command string?<br></blockquote><div><br></div>For my use case,=
each unique invocation of a command needs to have its<br>own buffer. So if=
you typed ls, followed by ls, if the buffer were<br>just named after the c=
ommand, then the output would be overwritten,<br>no? I suppose there are so=
me ways to ensure the name is unique, like<br>adding a timestamp or using (=
rename-uniquely), or maybe something<br>else. The broader idea here is to e=
mulate a shell, but rather than<br>concatenating commands together with the=
ir output, they are all<br>separated, separately searchable and saveable, a=
nd potentially each<br>having its own major-mode. More abstractly I was thi=
nking of<br>shell-command-buffer-name-functions along the same lines as the=
PS1<br>environment variable. I figured different users/packages might want=
<br>things to look one way or another.<br><br>So yeah, generally, I had ext=
ension in mind, and this seemed like the<br>most flexible way to get that w=
ithout imposing my niche way of doing<br>things on everyone else. And I wan=
ted to prevent other users from<br>getting into the same situation, where t=
hey need to rewrite their own<br>version of a very complex function like sh=
ell-command to get the<br>behavior they want. This certainly would remove a=
lot of maintenance<br>burden for me.</div></div></blockquote><div><br></di=
v><div class=3D"gmail_default" style=3D"font-family:monospace">Maybe an esh=
ell pipe contortion would work instead of using shell?=C2=A0 If it must be =
shell, could a new function be created instead of overloading the existing =
one perhaps named shell-command-to-buffer and it could default to a sensibl=
e buffer (current or otherwise) and allow specifying a name or a function t=
hat generates a name from the command string?</div></div></div>
--000000000000288a5c064e542e2e--
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.Received: (at 80688) by debbugs.gnu.org; 31 Mar 2026 15:56:25 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 31 11:56:24 2026 Received: from localhost ([127.0.0.1]:39542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w7bS1-0000Vg-Bn for submit <at> debbugs.gnu.org; Tue, 31 Mar 2026 11:56:24 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]:45433) 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 1w7bRy-0000V5-8n for 80688 <at> debbugs.gnu.org; Tue, 31 Mar 2026 11:56:19 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-b886fc047d5so951550666b.3 for <80688 <at> debbugs.gnu.org>; Tue, 31 Mar 2026 08:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774972577; cv=none; d=google.com; s=arc-20240605; b=E+Wvwv1vibNEuMLk8QljXUmOLmZJBOp8B69IDP1KZYXvSADg6hctlEW2uqo1kN8Osh ekbroUJ/Fca0BvjN/CjDehWNqW8x6BJsXPn0O6CcnUF1D9W0SOz4dx01a6NdTzp+dFzh 9YpxYuZgHop8uLhV5fcTwiwgyEYngRDpJJosXbHVXYCIHzku6UD/TSlJrK0CYNot3WS0 y7lCY9B3x43vMwM14jg4pNQUdHlGB8RmpQFUU+4A/dUt7vMFyEDJmHekCFG6RHbT42zy sjcin2kD642YxKCaCg0qd7xTLxCnJwKHUPggyRQWpHtIdKshqv/S6/Q/pA8q7dd0gVxl wQcw== 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=fcYL4PMW5i64GRqbNwnW/YrvhdmRDVHK0QHAOiebgqE=; fh=/LbIeTfDuqN3OJryKYy+l8Vi0omDJjm6C/Vg8use6Wk=; b=BXbqRZRGXTcFcT7SCKguL1HcDOr2/DcNz98dzF63AMoO7kfATeCpXMC3ZqcVTP+i1S VznMdAbmWl7PxZPlOCq5mP1eV1a1Ej4i2wrPCBxPVFl2R8YDbgE903g6GQ/i6+eiyOXE Oh1S6GCydPhIOQ8aj8y1jHhLXdZIqFW9gARJDqWPrd9RL64QdrACCqr075lcSmaSOFT5 XCAcu9YhR1bfMWMMbRyqe/03TIs8zQf7BXAQdnZpz2RgCE6gDxoO4QC+yGNLO/vwPEWl Jk7b1xm8cAQGbRL7t1wCGSIgsdPNBRJCijk2ZJSwBTY93K+juw7UwaDps/iZrOUVG8fm yWnQ==; 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=1774972577; x=1775577377; 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=fcYL4PMW5i64GRqbNwnW/YrvhdmRDVHK0QHAOiebgqE=; b=UmWAbYmLofuIv4xnIGLt9BwkAgy0LYy0f6F7aUpp5Qyy+NKJkK0FMf3OQA7V9P+O22 zLQaAyuJYqd9ZT2S3y2kEdXee80wuxOCUQJyHBiNCc4405cbb24koHsbwUTKiR9xbcDo gMuUS8AZuNeOGx+tibZ9BCxfHlYUyMDSt/q8r0Jtjtx8kYbAnfikj3mny+e9d7PML6B+ c9IpLkprPiQ1wj2oo/0UjyIx0+8C6Jdy+9I7c+kzDHkUIJSpHQDmgf5Tw8fP6VpTKkek /JHy2XVHorWNO+02/+E/aadFmXFYRrp5+XmDbNBcGX+LNcAw1Bqh/BjQ9IgsEsRh8joy OLRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774972577; x=1775577377; 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=fcYL4PMW5i64GRqbNwnW/YrvhdmRDVHK0QHAOiebgqE=; b=g2mor8BWWJGLP5SZo744m7oJCjgZR0nW9Xvu5vMAC2APPe0QdigvdsaV6iHMW4l1zV zA0ogQWC3KeImqIgzKiIWNFIqMjkfAROISPix7O0aquBkwkzEeddCsBjo7WBil0jISrL cQ6SEWDCzTzP2SLKr9A5CtOH5zLKduNA67heIRlXbCyblqx4C+azHWfn0HQOaaaVCvtX +ew2fJB96Y8Bl2P4d23GvCUm3azf6/Kwb0DNTR9nmjdE1As2mYY4/CspVzQP42C2Vy8p NDIE/1JCkfEmQKHawfQd49tlP7rNT0edgoy1LImyZSpGqWfBpFUv08JflrHZ3imOs+3b p7lw== X-Gm-Message-State: AOJu0Yza3l3r8pgZ4Z6+74cR1QHHejf3qLCmSANkaZ8ayOfoVjFAx/j0 mga65aD2DsAH87cfudCCwN/5ksmDRV9uXOVUJhx13M01pst55J3mpenjhSgiD9w4FgTA7fprkGF T/bbR+z77jz+EQHHmjArbUPVVBTSnG+iyRZwHJVM= X-Gm-Gg: ATEYQzxjzqoSIfCTVZC/jOAUl9g87N7jfAD75rs11058/yXemUiYfx9ZCkyKrNLbaoo cr41IccstzoEZ8QRsA6rmcLX6zXkBmV6OKN084TyO0MTuHOzA0ILQXQq7wvoYZPEWc07MklpTOo cG8n1pYa4Cxhz6P7dVzPI0FlPHMVYckOzsuW+sVCdSpmInb/7Th0IAUx87qgdGESqh5Sn0yE95R gsQJuZV+I01ZWPH/j2B6ZfOWlceFmOnSIoIn2LlH8V80V/BSeLvE6LtL66vC2rAXEojRuSlnKK4 2bZ1A7M= X-Received: by 2002:a17:906:af16:b0:b94:1df4:3525 with SMTP id a640c23a62f3a-b9c137a9cdfmr9705266b.1.1774972576533; Tue, 31 Mar 2026 08:56:16 -0700 (PDT) MIME-Version: 1.0 References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN> <867bqtqpmc.fsf@HIDDEN> In-Reply-To: <867bqtqpmc.fsf@HIDDEN> From: Samuel Morris <scmorris.dev@HIDDEN> Date: Tue, 31 Mar 2026 09:56:05 -0600 X-Gm-Features: AQROBzAVyshHxPgvY-VD_U-TEvfbUyHP0nBkl_1eBSe08w5uk8DaA8S_9pvCfXM Message-ID: <CAEkeNzj9+HC5Ktn_r_0LgxSG0xLZJeySk=B3tryzEbFn-drFNw@HIDDEN> Subject: Re: bug#80688: [PATCH 1/2] add shell-command-buffer-name-function To: Eli Zaretskii <eliz@HIDDEN> Content-Type: multipart/alternative; boundary="000000000000e90f54064e540116" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80688 Cc: 80688 <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 (/) --000000000000e90f54064e540116 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 30, 2026 at 9:55=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:39 -0600 > > > > From: "S.C. Morris" <scmorris.dev@HIDDEN> > > > > If non-nil, this variable is called by 'shell-command' with the command > > string (trailing '&' already stripped) to generate the output buffer > > name, overriding 'shell-command-buffer-name' and > > 'shell-command-buffer-name-async'. Both async and synchronous > > invocations use the function. > > > > * lisp/simple.el (shell-command-buffer-name-function): New defvar. > > (shell-command): Use it when computing the output buffer name. > > Document it in the docstring. > > Thanks. > > However, I wonder why do we need to go to such great lengths? How > about a simple boolean option, by default nil, which, if customized to > a non-nil value, will cause shell-command to create a buffer whose > name is the command string? > For my use case, each unique invocation of a command needs to have its own buffer. So if you typed ls, followed by ls, if the buffer were just named after the command, then the output would be overwritten, no? I suppose there are some ways to ensure the name is unique, like adding a timestamp or using (rename-uniquely), or maybe something else. The broader idea here is to emulate a shell, but rather than concatenating commands together with their output, they are all separated, separately searchable and saveable, and potentially each having its own major-mode. More abstractly I was thinking of shell-command-buffer-name-functions along the same lines as the PS1 environment variable. I figured different users/packages might want things to look one way or another. So yeah, generally, I had extension in mind, and this seemed like the most flexible way to get that without imposing my niche way of doing things on everyone else. And I wanted to prevent other users from getting into the same situation, where they need to rewrite their own version of a very complex function like shell-command to get the behavior they want. This certainly would remove a lot of maintenance burden for me. --000000000000e90f54064e540116 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 9:55=E2=80=AFAM E= li Zaretskii <<a href=3D"mailto:eliz@HIDDEN">eliz@HIDDEN</a>> wrote= :</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">> Cc: "S.C. Morris" <<a hr= ef=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmorris.dev@HIDDEN= om</a>><br> > From: <a href=3D"mailto:scmorris.dev@HIDDEN" target=3D"_blank">scmo= rris.dev@HIDDEN</a><br> > Date: Sun, 29 Mar 2026 16:48:39 -0600<br> > <br> > From: "S.C. Morris" <<a href=3D"mailto:scmorris.dev@gmail= .com" target=3D"_blank">scmorris.dev@HIDDEN</a>><br> > <br> > If non-nil, this variable is called by 'shell-command' with th= e command<br> > string (trailing '&' already stripped) to generate the out= put buffer<br> > name, overriding 'shell-command-buffer-name' and<br> > 'shell-command-buffer-name-async'.=C2=A0 Both async and synchr= onous<br> > invocations use the function.<br> > <br> > * lisp/simple.el (shell-command-buffer-name-function): New defvar.<br> > (shell-command): Use it when computing the output buffer name.<br> > Document it in the docstring.<br> <br> Thanks.<br> <br> However, I wonder why do we need to go to such great lengths?=C2=A0 How<br> about a simple boolean option, by default nil, which, if customized to<br> a non-nil value, will cause shell-command to create a buffer whose<br> name is the command string?<br></blockquote><div><br></div>For my use case,= each unique invocation of a command needs to have its<br>own buffer. So if= you typed ls, followed by ls, if the buffer were<br>just named after the c= ommand, then the output would be overwritten,<br>no? I suppose there are so= me ways to ensure the name is unique, like<br>adding a timestamp or using (= rename-uniquely), or maybe something<br>else. The broader idea here is to e= mulate a shell, but rather than<br>concatenating commands together with the= ir output, they are all<br>separated, separately searchable and saveable, a= nd potentially each<br>having its own major-mode. More abstractly I was thi= nking of<br>shell-command-buffer-name-functions along the same lines as the= PS1<br>environment variable. I figured different users/packages might want= <br>things to look one way or another.<br><br>So yeah, generally, I had ext= ension in mind, and this seemed like the<br>most flexible way to get that w= ithout imposing my niche way of doing<br>things on everyone else. And I wan= ted to prevent other users from<br>getting into the same situation, where t= hey need to rewrite their own<br>version of a very complex function like sh= ell-command to get the<br>behavior they want. This certainly would remove a= lot of maintenance<br>burden for me.</div></div> --000000000000e90f54064e540116--
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.Received: (at 80688) by debbugs.gnu.org; 30 Mar 2026 15:55:44 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 30 11:55:44 2026 Received: from localhost ([127.0.0.1]:52677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1w7Exr-0005qg-Lz for submit <at> debbugs.gnu.org; Mon, 30 Mar 2026 11:55:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43224) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1w7Exq-0005qA-4i for 80688 <at> debbugs.gnu.org; Mon, 30 Mar 2026 11:55:42 -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 1w7Exj-0001De-DJ; Mon, 30 Mar 2026 11:55:35 -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=fK80v3N48Wsrftf9U6VpAm3/izVIM71M9+Fj5LroQ28=; b=XDT1WCtbqspY qEksRPdLpFcMfdHkT4XsAyI1IddPj67yXuNtF7tGmizcj3U9QChRq1/CRiHpp2ldHrZNApQybTII0 /8HFwHGp23pmKwCkSaA2ywu69TvMR+Gzek7cMBaR9e1tuWGJjJeay63lqnd93hhrcgva8OD7n4ZZu 6mky2nISC7iVQegfVFZstYl9TLL6f1h4fm4LMfMH1kqAKj9WpTok5WZfHrk1nanyPnvQ78R5ll1Z2 iO3BYQ97GYwzns+3x2MAMQt4FtwJhEATAErt1f9x7zdJ/JLgzfugqnxkehqytUOPi74ZVVgJiJwxh i/o5VbZ95TVfQmTcDior3A==; Date: Mon, 30 Mar 2026 18:54:51 +0300 Message-Id: <867bqtqpmc.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: scmorris.dev@HIDDEN In-Reply-To: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN> Subject: Re: bug#80688: [PATCH 1/2] add shell-command-buffer-name-function References: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80688 Cc: 80688 <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:39 -0600 > > From: "S.C. Morris" <scmorris.dev@HIDDEN> > > If non-nil, this variable is called by 'shell-command' with the command > string (trailing '&' already stripped) to generate the output buffer > name, overriding 'shell-command-buffer-name' and > 'shell-command-buffer-name-async'. Both async and synchronous > invocations use the function. > > * lisp/simple.el (shell-command-buffer-name-function): New defvar. > (shell-command): Use it when computing the output buffer name. > Document it in the docstring. Thanks. However, I wonder why do we need to go to such great lengths? How about a simple boolean option, by default nil, which, if customized to a non-nil value, will cause shell-command to create a buffer whose name is the command string?
bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.
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]:39175 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1w6ywC-0007Xd-D3
for submit <at> debbugs.gnu.org; Sun, 29 Mar 2026 18:48:56 -0400
Received: from lists.gnu.org ([2001:470:142::17]:49396)
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 1w6yw8-0007Ws-T9
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 1w6yw2-0004H0-Tj
for bug-gnu-emacs@HIDDEN; Sun, 29 Mar 2026 18:48:46 -0400
Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e])
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 1w6yw1-0002Vu-Bg
for bug-gnu-emacs@HIDDEN; Sun, 29 Mar 2026 18:48:46 -0400
Received: by mail-ot1-x32e.google.com with SMTP id
46e09a7af769-7d7f592b8beso3354257a34.1
for <bug-gnu-emacs@HIDDEN>; Sun, 29 Mar 2026 15:48:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1774824523; x=1775429323; darn=gnu.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=q6LPv7q7iXf5FvE9uqLBvbv8GT+HtDArOWO09nDAgUs=;
b=RFVEYePHet5Mi9qi+OXQZoIZb2+Zppbklf8LZmLEZfyiA9oGlzYcq8aUQ7D4zVWq6p
xkFHJXR7Nyb2E5ouAsEKAespq2FrZos5/8LXd+s7B34r9BGs0cvoZEuNwl8hftfvRVB8
NEUMhZR+50leA2TizH+h+vvZneqzq7Lb0XLxeYY5vGWShIjNgqXGtEiCQA+GwQJaz0X2
nWqa8QwcFtJlTaZ5P0L8LbehPXTvfaTSiTjfBBv3eMrZPwCoea2S04onSl2jpNU28Ikg
aC1i/PrwIqqGLvpGy4r+UvBUJk55+h4S3Hl63jNn7gG9WA3tjaPPWWlvQJ3280MO2vCq
OL6A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1774824523; x=1775429323;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to;
bh=q6LPv7q7iXf5FvE9uqLBvbv8GT+HtDArOWO09nDAgUs=;
b=L0o6Ri0MFlGdgFWyRPU+afiUDzPCXGiyDgofD2WtvrXpoVIzIweZhvuxLWT8D8IwJz
StcOswgbiMOHZGCwl1aPJ1P74U4g192nLoNuJhnEbubZZYzZzZGgsPJ41FHK2ElxMPZj
kbYtA/+2kNNkFav7r4OlYCkr9ap5L0gIGC7Ij6/+lAc8osMCbfMlLw2CJTSwEkOjRe+A
dnTWyI9ZWIUzf6W35AYUv18HOcAlgSNfKYp16TXciQn76Q5ZhXzXtjMNl/8ZH5o6Qqb7
5iOXJjIsjqRmvZ/dZUTyuWnRsmtKuHdfwY8Cy9JtKlr/AEjjMj2kUDbEPxEb6c0507J6
Pu9A==
X-Gm-Message-State: AOJu0Yz8E28JgLeJiLmQm+Wh5jG6LInljVSVfIzLplMaEyiO+vr4VKJk
JSRXZG8jUXrHH3uPjJxXEo9pAB57W5E3EmnZqBgZ62wo/EOg54UDVxA2g3lHQQ==
X-Gm-Gg: ATEYQzzXB9Rkp9YI398+5ZFwTkkxhwM5wxbDzD/92ulEf6eIdXWJuPJ/AZ5nY1aiGxP
LHRjWiV7zsjS6R0PaTTWXe4J9jUcjkPUZc4j9vA8DdzGuiFmXI/IkvTWCOpWAbHr/RZU5aT+CGV
kLJNMQXHB/iLfKQ5jF6vdtuZyAdpCUZqdQJzl0WeP58WEJwP6vwQE5/a7uA0gCMofEIrG/sxMnW
ldyDA0XqiGhVk9sexGrcO8yuuNbknDgDf6IAfXalK/HBbC/obehbCXJYIA+K8N0uMBARWvgj2pN
EZ1RO8/AubIMe4//No/pidgqwRdEXYOnuQNRhsRQxQb0GGAOdGvsMh7Ob9XqQ5UZ3WAXyzAXYkg
91gpavAb52Kui67CnsaDjw5cfmaYF4Hp0CDaOK7UDz5wOyO1jBWNZLPUrg6cSseDCQpvLKMdWbc
QMoqRyoIPgkLni9z3mPeJsqZrhUTUFbwX45e/T8Cgj
X-Received: by 2002:a05:6830:82f9:b0:7d7:da43:387 with SMTP id
46e09a7af769-7d9faead555mr6732639a34.16.1774824522805;
Sun, 29 Mar 2026 15:48:42 -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.41
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 29 Mar 2026 15:48:42 -0700 (PDT)
From: scmorris.dev@HIDDEN
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH 1/2] add shell-command-buffer-name-function
Date: Sun, 29 Mar 2026 16:48:39 -0600
Message-ID: <6345fce0948d3a34dc316ae8d2b463262d4a2539.1774821272.git.scmorris.dev@HIDDEN>
X-Mailer: git-send-email 2.52.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2607:f8b0:4864:20::32e;
envelope-from=scmorris.dev@HIDDEN; helo=mail-ot1-x32e.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" If non-nil, this variable is called by
'shell-command' with the command string (trailing '&' already stripped) to
generate the output buffer name, overriding 'shell-command-buffer-name' and
'shell-com [...]
Content analysis details: (2.0 points, 10.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
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
-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]
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>
If non-nil, this variable is called by 'shell-command' with the command
string (trailing '&' already stripped) to generate the output buffer
name, overriding 'shell-command-buffer-name' and
'shell-command-buffer-name-async'. Both async and synchronous
invocations use the function.
* lisp/simple.el (shell-command-buffer-name-function): New defvar.
(shell-command): Use it when computing the output buffer name.
Document it in the docstring.
* etc/NEWS: Document it.
---
etc/NEWS | 6 ++++++
lisp/simple.el | 22 ++++++++++++++++++++--
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 2b4e81fee14..cd20ea90b3a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -4318,6 +4318,12 @@ This lets a Lisp program access the core functionality of the
program, choosing the program according to the operating system's
conventions.
++++
+** New variable 'shell-command-buffer-name-function'.
+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'.
+
+++
** '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 ff7ffafa3a1..44d9ff50c6f 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4302,6 +4302,12 @@ shell-command-buffer-name
(defconst shell-command-buffer-name-async "*Async Shell Command*"
"Name of the output buffer for asynchronous shell commands.")
+(defvar shell-command-buffer-name-function nil
+ "If non-nil, function to generate the output buffer name for shell commands.
+Called with one argument, the command string (without any trailing `&'),
+and should return a buffer name string. When nil, the default names
+`shell-command-buffer-name' and `shell-command-buffer-name-async' are used.")
+
(defvar shell-command-history nil
"History list for some commands that read shell commands.
@@ -4645,6 +4651,10 @@ shell-command
In an interactive call, the variable `shell-command-default-error-buffer'
specifies the value of ERROR-BUFFER.
+If `shell-command-buffer-name-function' is non-nil, it is called with
+COMMAND to generate the output buffer name, overriding
+`shell-command-buffer-name' and `shell-command-buffer-name-async'.
+
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)."
@@ -4728,7 +4738,11 @@ shell-command
(_ (or (not (string= command ""))
(error "Empty asynchronous command")))
(buffer (get-buffer-create
- (or output-buffer shell-command-buffer-name-async)))
+ (or output-buffer
+ (and shell-command-buffer-name-function
+ (funcall shell-command-buffer-name-function
+ command))
+ shell-command-buffer-name-async)))
(bname (buffer-name buffer))
(proc (get-buffer-process buffer))
(directory default-directory))
@@ -4800,7 +4814,11 @@ shell-command
`((name . ,nonce)))))))
;; Otherwise, command is executed synchronously.
(shell-command-on-region (point) (point) command
- output-buffer nil error-buffer))))))
+ (or output-buffer
+ (and shell-command-buffer-name-function
+ (funcall shell-command-buffer-name-function
+ command)))
+ nil error-buffer))))))
(defun shell-command--same-buffer-confirm (action)
(let ((help-form
--
2.52.0
scmorris.dev@HIDDEN:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#80688; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.