Subject: bug#62958: closed (Re: bug#62958: [PATCH] Set PAGER=cat in comint.el)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 26 May 2023 11:32:01 +0000

Your bug report

#62958: [PATCH] Set PAGER=cat in comint.el

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
62958: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62958
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#62958: [PATCH] Set PAGER=cat in comint.el
From: Eli Zaretskii <[email-masked]>
To: [email-masked]
Cc: [email-masked], [email-masked]
Date: Fri, 26 May 2023 14:31:58 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Cc: [email-masked], [email-masked]
> Date: Fri, 19 May 2023 09:09:54 +0300
> From: Eli Zaretskii <[email-masked]>
> 
> > From: Spencer Baugh <[email-masked]>
> > Cc: [email-masked],  [email-masked]
> > Date: Wed, 17 May 2023 10:55:16 -0400
> > 
> > Updated patch.
> 
> LGTM, thanks.

No further comment, so I've now installed this on the master branch,
and I'm therefore closing this bug.

Thanks.

Subject: [PATCH] Set PAGER=cat in comint.el
From: Spencer Baugh <[email-masked]>
To: [email-masked]
Date: Wed, 19 Apr 2023 17:57:38 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Paging is useless and annoying in comint-derived commands such as
async-shell-command and M-x shell.  It is a frequent footgun for new
Emacs users when they try to run commands which start a pager in such
modes.  I know a number of users who set PAGER=cat in their Emacs to
avoid it.

Simply adding (setenv "PAGER" "cat") globally is not correct, since
that will break modes like term, which support paging quite well.
It's only and exactly the comint-derived modes which don't need
paging.

Changing the default to "cat" in this way might be a bit
controversial...

In GNU Emacs 29.0.60 (build 3, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2023-03-13 built on
 igm-qws-u22796a
Repository revision: e759905d2e0828eac4c8164b09113b40f6899656
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: CentOS Linux 7 (Core)

Configured using:
 'configure --with-x-toolkit=lucid --with-modules
 --with-gif=ifavailable'

>From 0069a0253c73567b131ddc75d57e29d405d11a72 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <[email-masked]>
Date: Wed, 19 Apr 2023 17:44:54 -0400
Subject: [PATCH] Set PAGER=cat in comint.el

Paging is useless and annoying in comint-derived commands such as
async-shell-command and M-x shell.  It is a frequent footgun for new
Emacs users when they try to run commands which start a pager in such
modes.  I know a number of users who set PAGER=cat in their Emacs to
avoid it.

Simply adding (setenv "PAGER" "cat") globally is not correct, since
that will break modes like term, which support paging quite well.
It's only and exactly the comint-derived modes which don't need
paging.

Changing the default to "cat" in this way might be a bit
controversial...

* lisp/comint.el (comint-pager):
Add, defaulted to "cat".
(comint-exec-1):
Use comint-pager to set PAGER.
---
 lisp/comint.el | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lisp/comint.el b/lisp/comint.el
index 682b555a33c..915907c1bb9 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -258,6 +258,15 @@ comint-input-ring-file-name
 		 file)
   :group 'comint)
 
+(defcustom comint-pager "cat"
+  "If non-nil, the value to use for PAGER.
+gWhen this is nil, comint doesn't set PAGER at all."
+  :version "30.1"
+  :type '(choice (const :tag "Don't set PAGER" nil)
+                 (const :tag "cat" "cat")
+		 string)
+  :group 'comint)
+
 (defvar comint-input-ring-file-prefix nil
   "The prefix to skip when parsing the input ring file.
 This is useful in Zsh when the extended_history option is on.")
@@ -864,6 +873,7 @@ comint-exec-1
 	 (nconc
           (comint-term-environment)
 	  (list (format "INSIDE_EMACS=%s,comint" emacs-version))
+          (when comint-pager (list (format "PAGER=%s" comint-pager)))
 	  process-environment))
 	(default-directory
 	  (if (file-accessible-directory-p default-directory)
-- 
2.30.2