]> git.eshelyaron.com Git - emacs.git/commit
Add ability for Eshell virtual targets to handle closing the target
authorJim Porter <jporterbugs@gmail.com>
Thu, 23 May 2024 21:52:07 +0000 (14:52 -0700)
committerEshel Yaron <me@eshelyaron.com>
Thu, 30 May 2024 14:27:07 +0000 (16:27 +0200)
commit8dc5f8a6843b00ea7aba4b3d0c5d72322966e85e
treebfb4502e62caffa4c476a3b09d710d6484617f52
parent92a06555a7089beb7299b0203ca1d4e66f9afa05
Add ability for Eshell virtual targets to handle closing the target

This was documented to work by calling the output function with 'nil',
but that was never actually implemented.  Instead, for compatibility,
we now support a new (optional) close function.

* lisp/eshell/esh-io.el (eshell-virtual-targets): Update docstring.
(eshell-generic-target): New struct...
(eshell-function-target): ... inherit from it, and rename from
'eshell-virtual-target'.
(eshell-get-target): Handle already-created 'eshell-generic-target'.
(eshell-close-target): Call the target's close function if present.

* test/lisp/eshell/esh-io-tests.el (esh-io-test/virtual/device-close):
New test.

* doc/misc/eshell.texi (Redirection): Document the new behavior.

(cherry picked from commit 9daf1085a9b11e056079edce8dccca92d69bf891)
doc/misc/eshell.texi
lisp/eshell/esh-io.el
test/lisp/eshell/esh-io-tests.el