diff options
author | Jim Porter <jporterbugs@gmail.com> | 2022-01-19 21:57:38 -0800 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-02-21 18:39:40 +0100 |
commit | 76429f4d1792b890c6fc69a5bd7a5cdef28d257a (patch) | |
tree | 9461a2617ac14c0310834475b45bd0d1cd58da19 | |
parent | 76b91671a1403761d2bad999c69d24952898c04e (diff) | |
download | emacs-76429f4d1792b890c6fc69a5bd7a5cdef28d257a.tar.gz |
Ensure 'eshell-output-object' always returns nil for consistency
This prevents functions like 'eshell-print' from writing doubled
output when run in Eshell. Previously, the result would be:
~ $ eshell-print hi
hihi
* lisp/eshell/esh-io.el (eshell-output-object): Always return nil.
-rw-r--r-- | lisp/eshell/esh-io.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el index e457f65c185..fc1124561a5 100644 --- a/lisp/eshell/esh-io.el +++ b/lisp/eshell/esh-io.el @@ -491,14 +491,19 @@ Returns what was actually sent, or nil if nothing was sent." object) (defun eshell-output-object (object &optional handle-index handles) - "Insert OBJECT, using HANDLE-INDEX specifically)." + "Insert OBJECT, using HANDLE-INDEX specifically. +If HANDLE-INDEX is nil, output to `eshell-output-handle'. +HANDLES is the set of file handles to use; if nil, use +`eshell-current-handles'." (let ((target (car (aref (or handles eshell-current-handles) (or handle-index eshell-output-handle))))) - (if (and target (not (listp target))) - (eshell-output-object-to-target object target) - (while target - (eshell-output-object-to-target object (car target)) - (setq target (cdr target)))))) + (if (listp target) + (while target + (eshell-output-object-to-target object (car target)) + (setq target (cdr target))) + (eshell-output-object-to-target object target) + ;; Explicitly return nil to match the list case above. + nil))) (provide 'esh-io) ;;; esh-io.el ends here |