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

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

[elpa] externals/dtache dae6db33db 083/158: Fix various minor problems


From: ELPA Syncer
Subject: [elpa] externals/dtache dae6db33db 083/158: Fix various minor problems
Date: Wed, 19 Jan 2022 18:58:00 -0500 (EST)

branch: externals/dtache
commit dae6db33dbe3a0168027b579ac2ecd43510888d5
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    Fix various minor problems
---
 README.org        |  3 ++-
 dtache-compile.el | 14 ++++++++++----
 dtache.el         | 42 ++++++++++++++++++++++--------------------
 3 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/README.org b/README.org
index a04eed7d51..8d9597cd8f 100644
--- a/README.org
+++ b/README.org
@@ -182,7 +182,8 @@ A =use-package= configuration of the =dtache-consult= 
extension, which provides
 
 #+begin_src elisp
   (use-package dtache-consult
-    :commands dtache-consult-session)
+    :after dtache
+    :bind ([remap dtache-open-session] . dtache-consult-session))
 #+end_src
 
 The command =dtache-consult-session= is a replacement for 
=dtache-open-session=. The difference is that the consult command provides 
multiple session sources, which is defined in the =dtache-consult-sources= 
variable. Users can customize which sources to use, as well as use individual 
sources in other =consult= commands, such as =consult-buffer=. The users can 
also narrow the list of sessions by entering a key. The list of supported keys 
are:
diff --git a/dtache-compile.el b/dtache-compile.el
index a3200ab8f3..72458662d9 100644
--- a/dtache-compile.el
+++ b/dtache-compile.el
@@ -35,21 +35,27 @@
 ;;;; Commands
 
 ;;;###autoload
-(defun dtache-compile ()
+(defun dtache-compile (command &optional comint)
   "Run COMMAND through `compile' but in a 'dtache' session.
 Optionally enable COMINT if prefix-argument is provided."
-  (interactive)
+  (interactive
+   (list
+    (let ((command (eval compile-command)))
+      (if (or compilation-read-command current-prefix-arg)
+          (compilation-read-command command)
+        command))
+    (consp current-prefix-arg)))
   (let* ((dtache-enabled t)
          (dtache-session-action dtache-compile-session-action)
          (dtache-session-type 'compile)
          (dtache--dtach-mode 'create))
-    (call-interactively #'compile)))
+    (compile command comint)))
 
 ;;;###autoload
 (defun dtache-compile-recompile (&optional edit-command)
   "Re-compile by running `compile' but in a 'dtache' session.
 Optionally EDIT-COMMAND."
-  (interactive)
+  (interactive "P")
   (let* ((dtache-enabled t)
          (dtache-session-action dtache-compile-session-action)
          (dtache-session-type 'compile)
diff --git a/dtache.el b/dtache.el
index 93088bbfb1..f57fa6c93e 100644
--- a/dtache.el
+++ b/dtache.el
@@ -199,10 +199,10 @@
 ;;;; Commands
 
 ;;;###autoload
-(defun dtache-shell-command (command)
+(defun dtache-shell-command (command &optional suppress-output)
   "Execute COMMAND asynchronously with `dtache'.
 
-If called with prefix-argument the output is suppressed."
+Optionally SUPPRESS-OUTPUT."
   (interactive
    (list
     (read-shell-command (if shell-command-prompt-show-cwd
@@ -210,10 +210,11 @@ If called with prefix-argument the output is suppressed."
                                             (abbreviate-file-name
                                              default-directory))
                           "Dtache shell command: ")
-                        nil 'dtache-shell-command-history)))
+                        nil 'dtache-shell-command-history)
+    current-prefix-arg))
   (let ((dtache-session-type 'shell-command)
         (dtache-session-action dtache-shell-command-action))
-    (dtache-start-session command current-prefix-arg)))
+    (dtache-start-session command suppress-output)))
 
 ;;;###autoload
 (defun dtache-open-session (session)
@@ -440,23 +441,24 @@ nil before closing."
   "Start a `dtache' session running COMMAND.
 
 Optionally SUPPRESS-OUTPUT."
-  (if (and (not (eq dtache--dtach-mode 'attach))
-           (or suppress-output
-               (eq dtache--dtach-mode 'new)
-               (dtache-redirect-only-p command)))
-      (let* ((inhibit-message t)
-             (dtache--dtach-mode 'new)
-             (dtache--current-session (dtache-create-session command)))
+  (let ((inhibit-message t)
+        (dtache-enabled t)
+        (dtache--current-session
+         (or dtache--current-session
+             (dtache-create-session command))))
+    (if-let ((run-in-background
+              (and (not (eq dtache--dtach-mode 'attach))
+                   (or suppress-output
+                       (eq dtache--dtach-mode 'new)
+                       (dtache-redirect-only-p command))))
+             (dtache--dtach-mode 'new))
         (apply #'start-file-process-shell-command
-               `("dtache" nil ,command)))
-    (cl-letf* ((inhibit-message t)
-               ((symbol-function #'set-process-sentinel) #'ignore)
-               (dtache--dtach-mode (or dtache--dtach-mode 'create))
-               (buffer "*Dtache Shell Command*")
-               (dtache--current-session (or dtache--current-session 
(dtache-create-session command)))
-               (dtache-enabled t))
-      (funcall #'async-shell-command command buffer)
-      (with-current-buffer buffer (setq dtache--buffer-session 
dtache--current-session)))))
+               `("dtache" nil ,command))
+      (cl-letf* (((symbol-function #'set-process-sentinel) #'ignore)
+                 (dtache--dtach-mode (or dtache--dtach-mode 'create))
+                 (buffer "*Dtache Shell Command*"))
+        (funcall #'async-shell-command command buffer)
+        (with-current-buffer buffer (setq dtache--buffer-session 
dtache--current-session))))))
 
 (defun dtache-update-sessions ()
   "Update `dtache' sessions.



reply via email to

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