emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7811a7d38bb: Stop subprocesses from using inherited or default PA


From: Eli Zaretskii
Subject: master 7811a7d38bb: Stop subprocesses from using inherited or default PAGER
Date: Sat, 17 Aug 2024 05:24:50 -0400 (EDT)

branch: master
commit 7811a7d38bb7cb303dc66efa02eb95e75a03f39d
Author: Spencer Baugh <sbaugh@janestreet.com>
Commit: Eli Zaretskii <eliz@gnu.org>

    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.
    Users 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 @@ It is the default value of the variable `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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]