emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/eat f76c27cd93: Don't intercept background processes in Es


From: ELPA Syncer
Subject: [nongnu] elpa/eat f76c27cd93: Don't intercept background processes in Eshell
Date: Sun, 11 Dec 2022 23:58:32 -0500 (EST)

branch: elpa/eat
commit f76c27cd93ad5573353e931ec66ea968852519ba
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>

    Don't intercept background processes in Eshell
    
    * eat.el (eat--eshell-adjust-make-process-args): Don't do any
    change to the environment if 'eshell-current-subjob-p' is
    non-nil.
---
 eat.el | 94 ++++++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 49 insertions(+), 45 deletions(-)

diff --git a/eat.el b/eat.el
index de48353f39..6c66a42946 100644
--- a/eat.el
+++ b/eat.el
@@ -5474,6 +5474,8 @@ PROGRAM can be a shell command."
         (eat--eshell-cleanup))))
   (eshell-sentinel process message))
 
+(defvar eshell-current-subjob-p) ; In `esh-proc'.
+
 ;; HACK: This is a dirty hack, it can break easily.
 (defun eat--eshell-adjust-make-process-args (fn command args)
   "Setup an environment to adjust `make-process' arguments.
@@ -5481,53 +5483,55 @@ PROGRAM can be a shell command."
 Call FN with COMMAND and ARGS, and whenever `make-process' is called,
 modify its argument to change the filter, the sentinel and invoke
 `stty' from the new process."
-  (cl-letf*
-      (;; For Emacs 29 and above.
-       (make-process (symbol-function #'make-process))
-       ((symbol-function #'make-process)
-        (if (< emacs-major-version 29)
-            make-process
-          (lambda (&rest plist)
-            ;; Make sure we don't attack wrong process.
-            (if (not (equal (plist-get plist :command)
-                            (cons (file-local-name
-                                   (expand-file-name command))
-                                  args)))
-                (apply make-process plist)
-              (setf (plist-get plist :command)
-                    `("/usr/bin/env" "sh" "-c"
-                      ,(format "stty -nl echo rows %d columns %d \
+  (if eshell-current-subjob-p
+      (funcall fn command args)
+    (cl-letf*
+        (;; For Emacs 29 and above.
+         (make-process (symbol-function #'make-process))
+         ((symbol-function #'make-process)
+          (if (< emacs-major-version 29)
+              make-process
+            (lambda (&rest plist)
+              ;; Make sure we don't attack wrong process.
+              (if (not (equal (plist-get plist :command)
+                              (cons (file-local-name
+                                     (expand-file-name command))
+                                    args)))
+                  (apply make-process plist)
+                (setf (plist-get plist :command)
+                      `("/usr/bin/env" "sh" "-c"
+                        ,(format "stty -nl echo rows %d columns %d \
 sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\""
-                               (floor (window-screen-lines))
-                               (window-max-chars-per-line)
-                               null-device)
-                      ".." ,@(plist-get plist :command)))
-              (apply make-process plist)))))
-       ;; For Emacs 28.
-       (start-file-process (symbol-function #'start-file-process))
-       ((symbol-function #'start-file-process)
-        (if (< emacs-major-version 29)
-            (lambda (name buffer &rest command)
-              (apply start-file-process name buffer
-                     `("/usr/bin/env" "sh" "-c"
-                       ,(format "stty -nl echo rows %d columns %d \
+                                 (floor (window-screen-lines))
+                                 (window-max-chars-per-line)
+                                 null-device)
+                        ".." ,@(plist-get plist :command)))
+                (apply make-process plist)))))
+         ;; For Emacs 28.
+         (start-file-process (symbol-function #'start-file-process))
+         ((symbol-function #'start-file-process)
+          (if (< emacs-major-version 29)
+              (lambda (name buffer &rest command)
+                (apply start-file-process name buffer
+                       `("/usr/bin/env" "sh" "-c"
+                         ,(format "stty -nl echo rows %d columns %d \
 sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\""
-                                (floor (window-screen-lines))
-                                (window-max-chars-per-line)
-                                null-device)
-                       ".." ,@command)))
-          ;; Don't override on Emacs 28.
-          start-file-process)))
-    (let ((hook
-           (lambda (proc)
-             (set-process-filter proc #'eat--eshell-filter)
-             (set-process-sentinel proc #'eat--eshell-sentinel)
-             (eat--eshell-setup-proc-and-term proc))))
-      (unwind-protect
-          (progn
-            (add-hook 'eshell-exec-hook hook 99)
-            (funcall fn command args))
-        (remove-hook 'eshell-exec-hook hook)))))
+                                  (floor (window-screen-lines))
+                                  (window-max-chars-per-line)
+                                  null-device)
+                         ".." ,@command)))
+            ;; Don't override on Emacs 28.
+            start-file-process)))
+      (let ((hook
+             (lambda (proc)
+               (set-process-filter proc #'eat--eshell-filter)
+               (set-process-sentinel proc #'eat--eshell-sentinel)
+               (eat--eshell-setup-proc-and-term proc))))
+        (unwind-protect
+            (progn
+              (add-hook 'eshell-exec-hook hook 99)
+              (funcall fn command args))
+          (remove-hook 'eshell-exec-hook hook))))))
 
 
 ;;;;; Minor Modes.



reply via email to

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