Subject: bug#72426: 29.2.50; comint-pager doesn't affect async-shell-command

From: Eli Zaretskii <[email-masked]>
Date: Tue, 06 Aug 2024 18:50:42 +0300

> From: Spencer Baugh <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Tue, 06 Aug 2024 11:31:06 -0400
> 
> Jim Porter <[email-masked]> 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.