Support "/dev/null" as a target when creating Eshell handles
Previously, you could only use this when setting the handle afterwards. Do not merge to master. * lisp/eshell/esh-io.el (eshell-set-output-handle): Don't catch 'eshell-null-device' here... (eshell-get-target): ... catch it here.
This commit is contained in:
@@ -431,11 +431,10 @@ current list of targets."
|
|||||||
(when defaultp
|
(when defaultp
|
||||||
(cl-decf (cdar handle))
|
(cl-decf (cdar handle))
|
||||||
(setcar handle (cons nil 1)))
|
(setcar handle (cons nil 1)))
|
||||||
(catch 'eshell-null-device
|
(let ((current (caar handle))
|
||||||
(let ((current (caar handle))
|
(where (eshell-get-target target mode)))
|
||||||
(where (eshell-get-target target mode)))
|
(when (and where (not (member where current)))
|
||||||
(unless (member where current)
|
(setcar (car handle) (append current (list where)))))
|
||||||
(setcar (car handle) (append current (list where))))))
|
|
||||||
(setcar (cdr handle) nil))))
|
(setcar (cdr handle) nil))))
|
||||||
|
|
||||||
(defun eshell-copy-output-handle (index index-to-copy &optional handles)
|
(defun eshell-copy-output-handle (index index-to-copy &optional handles)
|
||||||
@@ -611,11 +610,13 @@ return an `eshell-generic-target' instance; otherwise, return a
|
|||||||
marker for a file named TARGET."
|
marker for a file named TARGET."
|
||||||
(setq mode (or mode 'insert))
|
(setq mode (or mode 'insert))
|
||||||
(if-let ((redir (assoc raw-target eshell-virtual-targets)))
|
(if-let ((redir (assoc raw-target eshell-virtual-targets)))
|
||||||
(let ((target (if (nth 2 redir)
|
(let (target)
|
||||||
(funcall (nth 1 redir) mode)
|
(catch 'eshell-null-device
|
||||||
(nth 1 redir))))
|
(setq target (if (nth 2 redir)
|
||||||
(unless (eshell-generic-target-p target)
|
(funcall (nth 1 redir) mode)
|
||||||
(setq target (eshell-function-target-create target)))
|
(nth 1 redir)))
|
||||||
|
(unless (eshell-generic-target-p target)
|
||||||
|
(setq target (eshell-function-target-create target))))
|
||||||
target)
|
target)
|
||||||
(let ((exists (get-file-buffer raw-target))
|
(let ((exists (get-file-buffer raw-target))
|
||||||
(buf (find-file-noselect raw-target t)))
|
(buf (find-file-noselect raw-target t)))
|
||||||
|
|||||||
Reference in New Issue
Block a user