branch: externals/dtache
commit 28cb384d9612d2c74bb42ea52b9bb919c3c01f73
Author: Niklas Eklund <[email protected]>
Commit: Niklas Eklund <[email protected]>
Update attach with fallback
---
dtache.el | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/dtache.el b/dtache.el
index 3f19da9a38..eef31a7c90 100644
--- a/dtache.el
+++ b/dtache.el
@@ -327,16 +327,19 @@ Optionally SUPPRESS-OUTPUT."
(interactive
(list (dtache-completing-read (dtache-get-sessions))))
(when (dtache-valid-session session)
- (let* ((dtache--current-session session)
- (dtache-session-mode 'attach)
- (inhibit-message t))
- (if (not (dtache--session-attachable session))
- (dtache-tail-output session)
- (cl-letf* (((symbol-function #'set-process-sentinel) #'ignore)
- (buffer dtache--shell-command-buffer)
- (dtach-command (dtache-dtach-command session t)))
- (funcall #'async-shell-command dtach-command buffer)
- (with-current-buffer buffer (setq dtache--buffer-session
dtache--current-session)))))))
+ (if (or (eq 'inactive (dtache--session-state session))
+ (not (dtache--session-attachable session)))
+ (dtache-open-output session)
+ (let* ((dtache--current-session session)
+ (dtache-session-mode 'attach)
+ (inhibit-message t))
+ (if (not (dtache--session-attachable session))
+ (dtache-tail-output session)
+ (cl-letf* (((symbol-function #'set-process-sentinel) #'ignore)
+ (buffer dtache--shell-command-buffer)
+ (dtach-command (dtache-dtach-command session t)))
+ (funcall #'async-shell-command dtach-command buffer)
+ (with-current-buffer buffer (setq dtache--buffer-session
dtache--current-session))))))))
;;;###autoload
(defun dtache-copy-session-output (session)