]> git.eshelyaron.com Git - emacs.git/commit
Be more efficient when buffering output in Eshell
authorJim Porter <jporterbugs@gmail.com>
Tue, 4 Jun 2024 05:01:48 +0000 (22:01 -0700)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Jun 2024 05:31:47 +0000 (07:31 +0200)
commitc732c4857dd04d64c7874d7fab6faa0bc5387d1a
tree714e2c0e3ea3941348ae4f84702891576ad27ac6
parent2df48621f77f146231e0dda8f6e244b4530376f4
Be more efficient when buffering output in Eshell

This makes the built-in 'eshell/cat' 5-10x faster on large files in my
(somewhat limited) tests.  In addition, this change periodically
redisplays when using the Eshell buffered output so that users can see
some progress.

* lisp/eshell/esh-io.el (eshell-print-queue-size, eshell-print-queue,
eshell-print-queue-count): Make obsolete in favor of...
(eshell-buffered-print-size, eshell--buffered-print-queue)
(eshell--buffered-print-current-size): ... these.
(eshell-buffered-print-redisplay-throttle): New user option.
(eshell--buffered-print-next-redisplay): New variable.
(eshell-init-print-buffer): Make obsolete.
(eshell-flush): Add new REDISPLAY-NOW argument in favor of CLEAR (which
only 'eshell-init-print-buffer' should have used).
(eshell-buffered-print): Compare queued output length to
'eshell--buffered-print-current-size'.
(eshell-with-buffered-print): New macro.

* lisp/eshell/esh-var.el (eshell/env):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-hist.el (eshell/history):
* lisp/eshell/em-unix.el (eshell/cat):
* lisp/eshell/em-ls.el (eshell/ls): Use 'eshell-with-buffered-print'.
(flush-func): Remove.
(eshell-ls--insert-directory, eshell-do-ls): Remove 'flush-func'.

* test/lisp/eshell/em-unix-tests.el (em-unix-test/compile/interactive)
(em-unix-test/compile/pipeline, em-unix-test/compile/subcommand): Fix
indentation.
(em-unix-test/cat/file-output): New test.

* etc/NEWS: Announce these improvements.

(cherry picked from commit 2fac71255f2e216481f956ad318378cdfddb9402)
etc/NEWS
lisp/eshell/em-dirs.el
lisp/eshell/em-hist.el
lisp/eshell/em-ls.el
lisp/eshell/em-unix.el
lisp/eshell/esh-io.el
lisp/eshell/esh-var.el
test/lisp/eshell/em-unix-tests.el