branch: externals/dtache commit 71966f0d2f3c4cf5bb6e2951b8ddcfc0d7370359 Author: Niklas Eklund <niklas.ekl...@posteo.net> Commit: Niklas Eklund <niklas.ekl...@posteo.net>
Add run as an action property By adding a run property it makes it possible to rerun a session through the same command as before. This is especially noticeable for dtache-compile sessions. --- dtache-compile.el | 2 +- dtache-eshell.el | 2 +- dtache-shell.el | 2 +- dtache.el | 9 ++++++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dtache-compile.el b/dtache-compile.el index 923e475781..824b977f38 100644 --- a/dtache-compile.el +++ b/dtache-compile.el @@ -29,7 +29,7 @@ ;;;; Variables -(defvar dtache-post-compile-session-action '(:attach dtache-compile-attach :view dtache-post-compile-session)) +(defvar dtache-post-compile-session-action '(:attach dtache-compile-attach :view dtache-post-compile-session :run dtache-compile)) ;;;; Commands diff --git a/dtache-eshell.el b/dtache-eshell.el index addbf7a708..fb0387775c 100644 --- a/dtache-eshell.el +++ b/dtache-eshell.el @@ -32,7 +32,7 @@ ;;;; Variables -(defvar dtache-eshell-session-action '(:attach dtache-shell-command-attach :view dtache-view-dwim)) +(defvar dtache-eshell-session-action '(:attach dtache-shell-command-attach :view dtache-view-dwim :run dtache-shell-command)) ;;;; Functions diff --git a/dtache-shell.el b/dtache-shell.el index 4fae7c4ea2..7329b0b03d 100644 --- a/dtache-shell.el +++ b/dtache-shell.el @@ -31,7 +31,7 @@ (defvar dtache-shell-history-file nil "File to store history.") -(defvar dtache-shell-session-action '(:attach dtache-shell-command-attach :view dtache-view-dwim) +(defvar dtache-shell-session-action '(:attach dtache-shell-command-attach :view dtache-view-dwim :run dtache-shell-command) "Actions for a session created with `dtache-shell'.") ;;;; Functions diff --git a/dtache.el b/dtache.el index 108e710f0c..b90e6bfe75 100644 --- a/dtache.el +++ b/dtache.el @@ -79,7 +79,7 @@ "An alist of annotators for metadata.") (defvar dtache-timer-configuration '(:seconds 10 :repeat 60 :function run-with-timer) "A property list defining how often to run a timer.") -(defvar dtache-shell-command-action '(:attach dtache-shell-command-attach :view dtache-view-dwim) +(defvar dtache-shell-command-action '(:attach dtache-shell-command-attach :view dtache-view-dwim :run dtache-shell-command) "Actions for a session created with `dtache-shell-command'.") (defvar dtache-annotation-format `((:width 3 :function dtache--active-str :face dtache-active-face) @@ -266,8 +266,11 @@ Optionally SUPPRESS-OUTPUT." (when (dtache-valid-session session) (let* ((default-directory (dtache--session-working-directory session)) - (dtache-session-action (dtache--session-action session))) - (dtache-start-session (dtache--session-command session))))) + (dtache-session-action (dtache--session-action session)) + (command (dtache--session-command session))) + (if-let ((run-fun (plist-get (dtache--session-action session) :run))) + (funcall run-fun command) + (dtache-start-session command))))) ;;;###autoload (defun dtache-copy-session-output (session)