unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62958: [PATCH] Set PAGER=cat in comint.el
@ 2023-04-19 21:57 Spencer Baugh
  2023-04-20  6:43 ` Eli Zaretskii
  0 siblings, 1 reply; 31+ messages in thread
From: Spencer Baugh @ 2023-04-19 21:57 UTC (permalink / raw)
  To: 62958

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

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'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Set-PAGER-cat-in-comint.el.patch --]
[-- Type: text/patch, Size: 1915 bytes --]

From 0069a0253c73567b131ddc75d57e29d405d11a72 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@janestreet.com>
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


^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2023-05-26 11:31 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 21:57 bug#62958: [PATCH] Set PAGER=cat in comint.el Spencer Baugh
2023-04-20  6:43 ` Eli Zaretskii
2023-04-20 15:47   ` Spencer Baugh
2023-04-20 15:56     ` Eli Zaretskii
2023-04-20 16:01       ` Spencer Baugh
2023-05-05  6:35         ` Eli Zaretskii
2023-05-08 19:38           ` Spencer Baugh
2023-05-09  5:08             ` Eli Zaretskii
2023-05-09 14:55               ` sbaugh
2023-05-09 15:46                 ` Eli Zaretskii
2023-05-09 16:30                   ` Spencer Baugh
2023-05-09 16:43                     ` Eli Zaretskii
2023-05-09 16:53                       ` Spencer Baugh
2023-05-09 16:59                         ` Eli Zaretskii
2023-05-09 17:01                           ` Spencer Baugh
2023-05-09 17:05                             ` Eli Zaretskii
2023-05-09 17:13                               ` Spencer Baugh
2023-05-09 18:58                                 ` Eli Zaretskii
2023-05-16 19:49                                   ` Spencer Baugh
2023-05-17 11:32                                     ` Eli Zaretskii
2023-05-17 14:55                                       ` Spencer Baugh
2023-05-19  6:09                                         ` Eli Zaretskii
2023-05-26 11:31                                           ` Eli Zaretskii
2023-05-09 17:03                           ` Eli Zaretskii
2023-05-10 16:39                 ` Juri Linkov
2023-05-10 16:59                   ` Eli Zaretskii
2023-05-10 18:13                   ` Gregory Heytings
2023-05-12 17:49                     ` Juri Linkov
2023-05-12 22:21                       ` Gregory Heytings
2023-04-26  7:54   ` Philip Kaludercic
2023-04-26  9:15     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).