GNU bug report logs - #72426
29.2.50; comint-pager doesn't affect async-shell-command

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Fri, 2 Aug 2024 18:36:01 UTC

Severity: normal

Found in version 29.2.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #59 received at 72426 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: jporterbugs <at> gmail.com, 72426 <at> debbugs.gnu.org
Subject: Re: bug#72426: 29.2.50; comint-pager doesn't affect
 async-shell-command
Date: Tue, 06 Aug 2024 15:23:25 -0400
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> Cc: jporterbugs <at> gmail.com,  72426 <at> debbugs.gnu.org
>> Date: Tue, 06 Aug 2024 14:49:45 -0400
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> >> From: Spencer Baugh <sbaugh <at> janestreet.com>
>> >> Cc: jporterbugs <at> gmail.com,  72426 <at> debbugs.gnu.org
>> >> Date: Tue, 06 Aug 2024 12:42:09 -0400
>> >> 
>> >> --- a/lisp/startup.el
>> >> +++ b/lisp/startup.el
>> >> @@ -854,6 +854,10 @@ normal-top-level
>> >>      ;; We are careful to do it late (after term-setup-hook), although the
>> >>      ;; new multi-tty code does not use $TERM any more there anyway.
>> >>      (setenv "TERM" "dumb")
>> >> +    ;; Likewise, subprocesses should not use a pager unless told
>> >> +    ;; otherwise, since it generally won't work.
>> >> +    (when (executable-find "cat")
>> >> +      (setenv "PAGER" "cat"))
>> >
>> > We need to work on the comment, because it doesn't explain any of what
>> > it needs to.  Worse, it says something very confusing and at least
>> > inaccurate.
>> 
>> Could you just say what you'd prefer the comment to be?  I'm not sure
>> what exactly you'd like it to explain.
>
> I don't have a clear enough idea; I hoped you did, since you initiated
> this change to begin with.  I just know that the text you wrote cannot
> be it, because it didn't explain to me anything about the reasons we
> should be doing this.  The comment should explain why PAGER=cat is a
> good idea to go with TERM=dumb, for example.  Maybe begin by saying
> why Emacs needs to set the variable at all, why not leave it unset?

OK, how about this?

[0001-Stop-subprocesses-from-using-inherited-or-default-PA.patch (text/x-patch, inline)]
From b50a5ef015280a585330d4fcfc1265d65ce1dd88 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Tue, 6 Aug 2024 12:39:37 -0400
Subject: [PATCH] Stop subprocesses from using inherited or default PAGER

At startup, set PAGER to cat so that any inherited or default
value of PAGER does not affect subprocesses of Emacs.  Pagers
generally won't work when a subprocess runs under Emacs.

A user can use comint-pager (or other customizations) to tell
subprocesses to use a different specific pager.

* lisp/startup.el (normal-top-level): Set PAGER to cat, if cat
is available. (bug#72426)
---
 lisp/startup.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lisp/startup.el b/lisp/startup.el
index f18795ae6ac..738eec772ec 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -854,6 +854,12 @@ normal-top-level
     ;; We are careful to do it late (after term-setup-hook), although the
     ;; new multi-tty code does not use $TERM any more there anyway.
     (setenv "TERM" "dumb")
+    ;; Similarly, a subprocess should not try to invoke a pager, as most
+    ;; pagers will fail in a dumb terminal.  Many programs default to
+    ;; using "less" when PAGER is unset, so set PAGER to "cat"; using cat
+    ;; as a pager is equivalent to not using a pager at all.
+    (when (executable-find "cat")
+      (setenv "PAGER" "cat"))
     ;; Remove DISPLAY from the process-environment as well.  This allows
     ;; `callproc.c' to give it a useful adaptive default which is either
     ;; the value of the `display' frame-parameter or the DISPLAY value
-- 
2.39.3


This bug report was last modified 246 days ago.

Previous Next


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