bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Spencer Baugh
Subject: bug#62958: [PATCH] Set PAGER=cat in comint.el
Date: Tue, 09 May 2023 12:30:42 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: sbaugh@catern.com
>> Date: Tue, 09 May 2023 14:55:31 +0000 (UTC)
>> Cc: Spencer Baugh <sbaugh@janestreet.com>, 62958@debbugs.gnu.org
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> From: Spencer Baugh <sbaugh@janestreet.com>
>> >> Cc: 62958@debbugs.gnu.org
>> >> Date: Mon, 08 May 2023 15:38:12 -0400
>> >> 
>> >> >   Pagination is not needed, and gets in the way, when the output of
>> >> >   the program is directed to an Emacs buffer, so in those cases
>> >> >   pagination should be disabled.  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."
>> >> 
>> >> I think it's worth noting the fact that there are programs which depend
>> >> on pagination for their normal functionality.  How about this short
>> >> additional paragraph added after your text:
>> >> 
>> >> "Disabling pagination means programs will produce their entire output
>> >> immediately.  If only part of the output is useful, this can be
>> >> wasteful.  For some programs, this can be avoided by using commands (for
>> >> example, `vc-print-log') which run the program, limit the output it
>> >> produces, and let the user interactively browse the output inside
>> >> Emacs."
>> >
>> > Sorry, I don't understand: why would it matter that a program produces
>> > its output immediately when that output is redirected to an Emacs
>> > buffer?  Whatever the amount of output, the user can always page
>> > through it interactively and conveniently using the normal movement
>> > commands, no?  What am I missing?
>> 
>> If the command produces a lot of output it can take a long time to run
>> and slow down Emacs.
>> 
>> For example, if a user disables pagination, runs M-x shell, and then
>> runs "git log" in the Emacs repo, it takes ~3.5 minutes to run and
>> produces ~1.5 million lines.  Even if all they want is to see the 10
>> most recent commits.  There are several negative effects of this, in
>> decreasing order of importance:
>> 
>> - The shell buffer now has way more output, which slows down navigation
>> and operations on that buffer forever after, including font lock.
>> - The user's shell is blocked during that whole time, preventing further
>> shell commands.
>> - git log producing unnecessary output wastes CPU and IO.
>> 
>> If "git log" is run with a pager, it can complete as soon as the user
>> exits the pager, and it only produces a few lines.
>
> But this is impossible in general, AFAIU: most comint clients aren't
> prepared for interactive paging anyway.  If someone wants paging, they
> should use "M-x term" or "M-x ansi-term", the terminal emulators that
> Emacs provides.

Yes.  I of course know that, that's why I filed this bug :)

Nevertheless, today by default many programs run in comint clients will
run a pager, and even though it is a hassle and gets in the way inside
Emacs, it does prevent some programs from producing lots of output and
yielding the negative effects I mentioned previously:

>> - The shell buffer now has way more output, which slows down navigation
>> and operations on that buffer forever after, including font lock.
>> - The user's shell is blocked during that whole time, preventing further
>> shell commands.
>> - git log producing unnecessary output wastes CPU and IO.

Because of these negative effects which will start happening for some
programs when the user disables pagination, I think it's important for
users to know that there's alternatives for such programs: namely, using
native Emacs interfaces like vc-print-log.





reply via email to

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