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

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

[elpa] externals/dtache 99876aaaa3 3/3: Use dtache-quit-tail-session in


From: ELPA Syncer
Subject: [elpa] externals/dtache 99876aaaa3 3/3: Use dtache-quit-tail-session in tail-mode
Date: Sat, 22 Jan 2022 13:57:30 -0500 (EST)

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

    Use dtache-quit-tail-session in tail-mode
---
 dtache.el | 64 ++++++++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 39 insertions(+), 25 deletions(-)

diff --git a/dtache.el b/dtache.el
index faf5cb1eb9..46a7e5c664 100644
--- a/dtache.el
+++ b/dtache.el
@@ -453,31 +453,33 @@ active session.  For sessions created with 
`dtache-compile' or
 `dtache-shell-command', the command will also kill the window."
   (interactive)
   (if (dtache-session-p dtache--buffer-session)
-      (if-let ((command-or-compile
-                (cond ((string-match dtache--shell-command-buffer 
(buffer-name)) t)
-                      ((string-match "\*dtache-compilation" (buffer-name)) t)
-                      ((eq major-mode 'dtache-log-mode) t)
-                      ((eq major-mode 'dtache-tail-mode) t)
-                      (t nil))))
-          ;; `dtache-shell-command' or `dtache-compile'
-          (let ((kill-buffer-query-functions nil))
-            (when-let ((process (get-buffer-process (current-buffer))))
-              (comint-simple-send process dtache--dtach-detach-character)
-              (message "[detached]"))
-            (setq dtache--buffer-session nil)
-            (kill-buffer-and-window))
-        (if (eq 'active (dtache--determine-session-state 
dtache--buffer-session))
-            ;; `dtache-eshell'
-            (if-let ((process (and (eq major-mode 'eshell-mode)
-                                   (dtache-eshell-get-dtach-process))))
-                (progn
-                  (setq dtache--buffer-session nil)
-                  (process-send-string process dtache--dtach-detach-character))
-              ;; `dtache-shell'
-              (let ((process (get-buffer-process (current-buffer))))
-                (comint-simple-send process dtache--dtach-detach-character)
-                (setq dtache--buffer-session nil)))
-          (message "No active dtache-session found in buffer.")))
+      (if (eq major-mode 'dtache-tail-mode)
+          (dtache-quit-tail-session)
+          (if-let ((command-or-compile
+                    (cond ((string-match dtache--shell-command-buffer 
(buffer-name)) t)
+                          ((string-match "\*dtache-compilation" (buffer-name)) 
t)
+                          ((eq major-mode 'dtache-log-mode) t)
+                          ((eq major-mode 'dtache-tail-mode) t)
+                          (t nil))))
+              ;; `dtache-shell-command' or `dtache-compile'
+              (let ((kill-buffer-query-functions nil))
+                (when-let ((process (get-buffer-process (current-buffer))))
+                  (comint-simple-send process dtache--dtach-detach-character)
+                  (message "[detached]"))
+                (setq dtache--buffer-session nil)
+                (kill-buffer-and-window))
+            (if (eq 'active (dtache--determine-session-state 
dtache--buffer-session))
+                ;; `dtache-eshell'
+                (if-let ((process (and (eq major-mode 'eshell-mode)
+                                       (dtache-eshell-get-dtach-process))))
+                    (progn
+                      (setq dtache--buffer-session nil)
+                      (process-send-string process 
dtache--dtach-detach-character))
+                  ;; `dtache-shell'
+                  (let ((process (get-buffer-process (current-buffer))))
+                    (comint-simple-send process dtache--dtach-detach-character)
+                    (setq dtache--buffer-session nil)))
+              (message "No active dtache-session found in buffer."))))
     (message "No dtache-session found in buffer.")))
 
 ;;;###autoload
@@ -492,6 +494,18 @@ active session.  For sessions created with 
`dtache-compile' or
                                  (dtache-get-sessions)))))
     (seq-do #'dtache--db-remove-entry sessions)))
 
+;;;###autoload
+(defun dtache-quit-tail-session ()
+  "Quit `dtache' tail session.
+
+The log can have been updated, but that is not done by the user but
+rather the tail mode.  To avoid a promtp `buffer-modified-p' is set to
+nil before closing."
+  (interactive)
+  (set-buffer-modified-p nil)
+  (setq dtache--buffer-session nil)
+  (kill-buffer-and-window))
+
 ;;;; Functions
 
 ;;;;; Session



reply via email to

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