From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#62958: [PATCH] Set PAGER=cat in comint.el Date: Wed, 19 Apr 2023 17:57:38 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37061"; mail-complaints-to="usenet@ciao.gmane.io" To: 62958@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 19 23:58:32 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ppFot-0009Vu-4t for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 19 Apr 2023 23:58:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppFoT-00056O-6x; Wed, 19 Apr 2023 17:58:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppFoR-000558-81 for bug-gnu-emacs@gnu.org; Wed, 19 Apr 2023 17:58:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ppFoQ-00008s-W0 for bug-gnu-emacs@gnu.org; Wed, 19 Apr 2023 17:58:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ppFoQ-0006wM-Ja for bug-gnu-emacs@gnu.org; Wed, 19 Apr 2023 17:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Apr 2023 21:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62958 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168194146726636 (code B ref -1); Wed, 19 Apr 2023 21:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Apr 2023 21:57:47 +0000 Original-Received: from localhost ([127.0.0.1]:36035 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppFoB-0006vY-Ad for submit@debbugs.gnu.org; Wed, 19 Apr 2023 17:57:47 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:33638) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ppFo6-0006vN-A9 for submit@debbugs.gnu.org; Wed, 19 Apr 2023 17:57:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppFo6-0004xC-37 for bug-gnu-emacs@gnu.org; Wed, 19 Apr 2023 17:57:42 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppFo4-00006O-4T for bug-gnu-emacs@gnu.org; Wed, 19 Apr 2023 17:57:41 -0400 Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@janestreet.com; helo=mxout5.mail.janestreet.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260296 Archived-At: --=-=-= Content-Type: text/plain 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' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Set-PAGER-cat-in-comint.el.patch >From 0069a0253c73567b131ddc75d57e29d405d11a72 Mon Sep 17 00:00:00 2001 From: Spencer Baugh 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 --=-=-=--