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, 17 May 2023 10:55:16 -0400 Message-ID: References: <83edof6oln.fsf@gnu.org> <83zg724kea.fsf@gnu.org> <835y97jnfd.fsf@gnu.org> <83pm7aay70.fsf@gnu.org> <874jol1rml.fsf@catern.com> <831qjpbj8j.fsf@gnu.org> <83wn1ha220.fsf@gnu.org> <83sfc5a1ag.fsf@gnu.org> <83pm79a103.fsf@gnu.org> <83mt2d9vsx.fsf@gnu.org> <83r0rfxkg3.fsf@gnu.org> 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="10137"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: sbaugh@catern.com, 62958@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 17 16:56:09 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 1pzIZU-0002Nl-Dh for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 May 2023 16:56:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzIZQ-0001hQ-SL; Wed, 17 May 2023 10:56:04 -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 1pzIZP-0001gz-8Y for bug-gnu-emacs@gnu.org; Wed, 17 May 2023 10:56: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 1pzIZO-00037H-Q7 for bug-gnu-emacs@gnu.org; Wed, 17 May 2023 10:56:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pzIZO-0006I9-ML for bug-gnu-emacs@gnu.org; Wed, 17 May 2023 10:56: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, 17 May 2023 14:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62958 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 62958-submit@debbugs.gnu.org id=B62958.168433532324015 (code B ref 62958); Wed, 17 May 2023 14:56:02 +0000 Original-Received: (at 62958) by debbugs.gnu.org; 17 May 2023 14:55:23 +0000 Original-Received: from localhost ([127.0.0.1]:50622 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzIYk-0006FD-Hq for submit@debbugs.gnu.org; Wed, 17 May 2023 10:55:23 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:41513) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzIYj-0006ET-Lc for 62958@debbugs.gnu.org; Wed, 17 May 2023 10:55:21 -0400 In-Reply-To: <83r0rfxkg3.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 17 May 2023 14:32:12 +0300") 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:261863 Archived-At: --=-=-= Content-Type: text/plain Updated patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Support-setting-PAGER-cat-in-comint.el-bug-62958.patch >From 94db0faf148960eeace9279fea9e173b1d1ea516 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Wed, 19 Apr 2023 17:44:54 -0400 Subject: [PATCH] Support setting PAGER=cat in comint.el (bug#62958) Paging can be undesirable 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. 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. * lisp/comint.el (comint-pager): Add. (bug#62958) (comint-exec-1): Use comint-pager to set PAGER. --- lisp/comint.el | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lisp/comint.el b/lisp/comint.el index 682b555a33c..b956bd6f697 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -258,6 +258,35 @@ comint-input-ring-file-name file) :group 'comint) +(defcustom comint-pager nil + "If non-nil, the program to use for pagination of program output. + +Some programs produce large amounts of output, and have provision for +pagination of their output through a filter program, commonly known as +a \"pager\". The pager limits the amount of output produced and +allows the user to interactively browse the output one page at a time. +Some programs paginate their output by default, by always starting a +pager. The program they use as the pager is specified by the +environment variable PAGER; if that variable is not defined, they use +some fixed default, such as \"less\". + +The interactive browsing aspects of pagination are not needed, and get +in the way, when the output of the program is directed to an Emacs +buffer, so in those cases pagination might need to be disabled. +Disabling pagination means that some programs will produce large +amounts of output, but most such programs have other ways to limit +their output, such as additional arguments or Emacs interfaces. +To disable pagination, this variable's value should be a string that +names a program, such as \"cat\", which passes through all of the +output without any filtering or delays. Comint will then set the +PAGER variable to name that program, when it invokes external +programs." + :version "30.1" + :type '(choice (const :tag "Use default PAGER" nil) + (const :tag "Don't do paging (PAGER=cat)" "cat") + (string :tag "Program name or absolute path of pager")) + :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 +893,10 @@ comint-exec-1 (nconc (comint-term-environment) (list (format "INSIDE_EMACS=%s,comint" emacs-version)) + (when comint-pager + (if (stringp comint-pager) + (list (format "PAGER=%s" comint-pager)) + (error "comint-pager should be a string: %s" comint-pager))) process-environment)) (default-directory (if (file-accessible-directory-p default-directory) -- 2.30.2 --=-=-=--