emacs-diffs
[Top][All Lists]
Advanced

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

emacs-30 5fbbc3d0cd2 2/2: Support "/dev/null" as a target when creating


From: Jim Porter
Subject: emacs-30 5fbbc3d0cd2 2/2: Support "/dev/null" as a target when creating Eshell handles
Date: Fri, 30 Aug 2024 00:53:58 -0400 (EDT)

branch: emacs-30
commit 5fbbc3d0cd277ec71de55c9fd9036afadc875020
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>

    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.
---
 lisp/eshell/esh-io.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index 570ace2ebb8..18fd1cdb0ec 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -431,11 +431,10 @@ current list of targets."
       (when defaultp
         (cl-decf (cdar handle))
         (setcar handle (cons nil 1)))
-      (catch 'eshell-null-device
-        (let ((current (caar handle))
-              (where (eshell-get-target target mode)))
-          (unless (member where current)
-            (setcar (car handle) (append current (list where))))))
+      (let ((current (caar handle))
+            (where (eshell-get-target target mode)))
+        (when (and where (not (member where current)))
+          (setcar (car handle) (append current (list where)))))
       (setcar (cdr handle) nil))))
 
 (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."
   (setq mode (or mode 'insert))
   (if-let ((redir (assoc raw-target eshell-virtual-targets)))
-      (let ((target (if (nth 2 redir)
-                        (funcall (nth 1 redir) mode)
-                      (nth 1 redir))))
-        (unless (eshell-generic-target-p target)
-          (setq target (eshell-function-target-create target)))
+      (let (target)
+        (catch 'eshell-null-device
+          (setq target (if (nth 2 redir)
+                           (funcall (nth 1 redir) mode)
+                         (nth 1 redir)))
+          (unless (eshell-generic-target-p target)
+            (setq target (eshell-function-target-create target))))
         target)
     (let ((exists (get-file-buffer raw-target))
           (buf (find-file-noselect raw-target t)))



reply via email to

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