all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Spencer Baugh <sbaugh@janestreet.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: jporterbugs@gmail.com, 72426@debbugs.gnu.org
Subject: bug#72426: 29.2.50; comint-pager doesn't affect async-shell-command
Date: Tue, 06 Aug 2024 12:42:09 -0400	[thread overview]
Message-ID: <ierwmkt38ny.fsf@janestreet.com> (raw)
In-Reply-To: <8634nhps4t.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 06 Aug 2024 18:50:42 +0300")

[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Spencer Baugh <sbaugh@janestreet.com>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  72426@debbugs.gnu.org
>> Date: Tue, 06 Aug 2024 11:31:06 -0400
>> 
>> Jim Porter <jporterbugs@gmail.com> writes:
>> 
>> > Perhaps we should be setting the pager in a similar way to how TERM is
>> > set in startup.el?
>> >
>> >     ;; Subprocesses of Emacs do not have direct access to the terminal, so
>> >     ;; unless told otherwise they should only assume a dumb terminal.
>> >     ;; 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")
>> >
>> > I think the reasoning in that comment applies to PAGER as well: unless
>> > told otherwise, subprocesses probably shouldn't use pager like "less";
>> > it's very unlikely to work correctly.
>> >
>> > In that case, would it make sense to add something along these lines
>> > to startup.el?
>> >
>> >     (when (executable-find "cat")
>> >       (setenv "PAGER" "cat"))
>> 
>> Yes, I'd be very in favor of that.  Fixing this is exactly my
>> motivation.
>
> We could perhaps try this on master.  If it doesn't cause trouble,
> maybe this is the right way, indeed.

Here's a patch which does this, for master.

(Everyone please feel free to CC me on any bugs or emacs-devel
discussions about this; I will try hard to fix any issues that crop up.)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Stop-subprocesses-from-using-inherited-or-default-PA.patch --]
[-- Type: text/x-patch, Size: 1425 bytes --]

From 14db307fd53a6c5b13a09ef3e023b0ba299d61a8 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@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 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lisp/startup.el b/lisp/startup.el
index f18795ae6ac..324f3aeee60 100644
--- 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"))
     ;; 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


  reply	other threads:[~2024-08-06 16:42 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02 18:35 bug#72426: 29.2.50; comint-pager doesn't affect async-shell-command Spencer Baugh
2024-08-02 18:39 ` Spencer Baugh
2024-08-03  5:48 ` Eli Zaretskii
2024-08-03 10:47   ` Spencer Baugh
2024-08-03 15:38     ` Eli Zaretskii
2024-08-03 16:42       ` Spencer Baugh
2024-08-03 17:18         ` Eli Zaretskii
2024-08-06 15:33           ` Spencer Baugh
2024-08-06 15:46             ` Eli Zaretskii
2024-08-06 16:29               ` Jim Porter
2024-08-06 18:02                 ` Eli Zaretskii
2024-08-03 18:38       ` Jim Porter
2024-08-06 15:31         ` Spencer Baugh
2024-08-06 15:50           ` Eli Zaretskii
2024-08-06 16:42             ` Spencer Baugh [this message]
2024-08-06 18:07               ` Eli Zaretskii
2024-08-06 18:49                 ` Spencer Baugh
2024-08-06 19:07                   ` Eli Zaretskii
2024-08-06 19:23                     ` Spencer Baugh
2024-08-07  2:36                       ` Jim Porter
2024-08-07 11:51                         ` Eli Zaretskii
2024-08-07 15:05                           ` Spencer Baugh
2024-08-07 15:26                             ` Eli Zaretskii
2024-08-07 15:31                               ` Spencer Baugh
2024-08-07 16:08                                 ` Jim Porter
2024-08-07 11:18                       ` Eli Zaretskii
2024-08-07 15:09                         ` Spencer Baugh
2024-08-17  9:25                       ` Eli Zaretskii
2024-09-13  1:17       ` Dmitry Gutov
2024-09-13  6:08         ` Eli Zaretskii
2024-09-13 23:45           ` Dmitry Gutov
2024-09-14  6:27             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ierwmkt38ny.fsf@janestreet.com \
    --to=sbaugh@janestreet.com \
    --cc=72426@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jporterbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.