branch: externals/dtache commit 02ee0a9487c149eafaa214525d7d1ab50938840b Author: Niklas Eklund <niklas.ekl...@posteo.net> Commit: Niklas Eklund <niklas.ekl...@posteo.net>
Utilize filenotify for remote sessions I haven't realized before that filenotify could watch for remote files. This seems to work great. For Linux distributions this should be the way to go. --- CHANELOG.org | 1 + dtache.el | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANELOG.org b/CHANELOG.org index 955f392015..618c8f8484 100644 --- a/CHANELOG.org +++ b/CHANELOG.org @@ -4,6 +4,7 @@ * Development +- =dtache= now uses =filenotify= for both local and remote sessions. If run on =macOS= timers are used both for local as well as remote sessions. - Add version for =dtache-session= objects. This makes dtache not break whenever non-backwards compatible changes are made to the dtache-session object. - The commands for launching sessions are now renamed to resemble the non dtache commands. The commands are =dtache-shell-command=, =dtache-shell-send-input=, =dtache-eshell-send-input=, =dtache-compile=. - Add action value to a session. This value is set to dtache-session-action which is a property list optionally specifying attach, view and run properties. These properties are then used in dwim commands to improve their functionality. diff --git a/dtache.el b/dtache.el index 220201cede..0c58937fcf 100644 --- a/dtache.el +++ b/dtache.el @@ -576,6 +576,9 @@ Optionally SUPPRESS-OUTPUT." ;; Start monitors (thread-last (dtache--db-get-sessions) (seq-filter (lambda (it) (eq 'active (dtache--session-state it)))) + (seq-remove (lambda (it) (when (dtache--session-missing-p it) + (dtache--db-remove-entry it) + t))) (seq-do #'dtache--start-session-monitor)) ;; Add `dtache-shell-mode' @@ -1103,10 +1106,12 @@ the current time is used." (defun dtache--start-session-monitor (session) "Start to monitor SESSION activity." - (if (file-remote-p (dtache--session-working-directory session)) - (dtache--session-timer-monitor session) + (let ((default-directory (dtache--session-working-directory session))) (if (eq system-type 'darwin) - (dtache--session-macos-monitor session) + ;; macOS requires a timer based solution + (if (file-remote-p default-directory) + (dtache--session-timer-monitor session) + (dtache--session-macos-monitor session)) (dtache--session-filenotify-monitor session)))) ;;;;; UI