[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/detached d1c3861e8e 16/38: Add public function for sess
From: |
ELPA Syncer |
Subject: |
[elpa] externals/detached d1c3861e8e 16/38: Add public function for session directory |
Date: |
Thu, 17 Nov 2022 17:57:54 -0500 (EST) |
branch: externals/detached
commit d1c3861e8e11e72302da796c422fcbfd91b2feae
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Add public function for session directory
---
detached-compile.el | 4 ++--
detached-list.el | 10 +++++-----
detached.el | 32 ++++++++++++++++++--------------
3 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/detached-compile.el b/detached-compile.el
index 825459bd55..616d7b069c 100644
--- a/detached-compile.el
+++ b/detached-compile.el
@@ -87,8 +87,8 @@ Optionally EDIT-COMMAND."
(let* ((detached-enabled t)
(detached-session-mode 'attach)
(detached-current-session session)
- (detached-local-session (detached--session-local session))
- (default-directory (detached--session-directory session)))
+ (detached-local-session (detached-session-local-p session))
+ (default-directory (detached-session-directory session)))
(compilation-start (detached--session-command session)))))
;;;;; Support functions
diff --git a/detached-list.el b/detached-list.el
index 5b406bdc05..7c7f5f1c27 100644
--- a/detached-list.el
+++ b/detached-list.el
@@ -136,7 +136,7 @@ Optionally initialize ALL session-directories."
(if-let* ((uninitialized-directories
(thread-last (detached-get-sessions)
(seq-filter #'detached-session-uninitialized-p)
- (seq-map #'detached--session-directory)
+ (seq-map #'detached-session-directory)
(seq-uniq))))
(if all
(seq-do #'detached-list--initialize-directory
uninitialized-directories)
@@ -423,7 +423,7 @@ Optionally TOGGLE-SUPPRESS-OUTPUT."
(list
(when-let* ((directories
(thread-last (detached-list--get-narrowed-sessions)
- (seq-map #'detached--session-directory)
+ (seq-map #'detached-session-directory)
(seq-uniq))))
(completing-read
"Select session directory: "
@@ -435,7 +435,7 @@ Optionally TOGGLE-SUPPRESS-OUTPUT."
,(lambda (sessions)
(seq-filter (lambda (it)
(string-match session-directory
- (detached--session-directory it)))
+ (detached-session-directory it)))
sessions)))))))
(defun detached-list-narrow-annotation (regexp)
@@ -684,7 +684,7 @@ If prefix-argument is provided unmark instead of mark."
(defun detached-list--initialize-directory (directory)
"Initialize sessions in DIRECTORY."
(thread-last (detached-get-sessions)
- (seq-filter (lambda (it) (string= directory
(detached--session-directory it))))
+ (seq-filter (lambda (it) (string= directory
(detached-session-directory it))))
(seq-do #'detached--initialize-session)))
(defun detached--list-parse-time (time)
@@ -847,7 +847,7 @@ If prefix-argument is provided unmark instead of mark."
"Return a narrowed list with SESSIONS containing REGEXP."
(let* ((sessions-and-directories
(thread-last sessions
- (seq-group-by #'detached--session-directory)
+ (seq-group-by #'detached-session-directory)
(seq-filter (lambda (it)
;; Filter out only accessible directories
(or (not (file-remote-p (car it)))
diff --git a/detached.el b/detached.el
index 6a1a7670c9..dace040160 100644
--- a/detached.el
+++ b/detached.el
@@ -576,7 +576,7 @@ Optionally DELETE the session if prefix-argument is
provided."
(list (detached-completing-read (detached-get-sessions))
current-prefix-arg))
(when (detached-valid-session session)
- (when-let* ((default-directory (detached--session-directory session))
+ (when-let* ((default-directory (detached-session-directory session))
(pid (detached-session-pid session)))
(detached--kill-processes pid))
(when delete
@@ -698,7 +698,7 @@ active session. For sessions created with
`detached-compile' or
:state 'unknown
:initialized-emacsen `(,(emacs-pid)))))
(detached--create-session-validator session)
- (detached--watch-session-directory (detached--session-directory session))
+ (detached--watch-session-directory (detached-session-directory session))
session)))
;;;###autoload
@@ -900,7 +900,7 @@ This function uses the `notifications' library."
(cl-letf* (((symbol-function #'set-process-sentinel) #'ignore)
(buffer (get-buffer-create detached--shell-command-buffer))
(detached-local-session (detached--session-local session))
- (default-directory (detached--session-directory session))
+ (default-directory (detached-session-directory session))
(command (detached-session-attach-command session :type
'string)))
(when (get-buffer-process buffer)
(setq buffer (generate-new-buffer (buffer-name buffer))))
@@ -1066,7 +1066,7 @@ This function uses the `notifications' library."
(string-join
`(,(detached--session-command session)
,(detached--host-str session)
- ,(detached--session-directory session))
+ ,(detached-session-directory session))
", "))
(defun detached-session-view-function (session)
@@ -1103,6 +1103,10 @@ This function uses the `notifications' library."
"Return command run in SESSION."
(detached--session-command session))
+(defun detached-session-directory (session)
+ "Return directory where SESSION files are located."
+ (detached--session-directory session))
+
(defun detached-session-started-p (session)
"Return t if SESSION has been started."
(not (eq 'unknown (detached-session-state session))))
@@ -1159,7 +1163,7 @@ This function uses the `notifications' library."
(defun detached-session-watched-p (session)
"Return t if SESSION is being watched."
(detached--watched-session-directory-p
- (detached--session-directory session)))
+ (detached-session-directory session)))
;;;;; Other
@@ -1243,7 +1247,7 @@ This function uses the `notifications' library."
(defun detached--session-accessible-p (session)
"Return t if SESSION is accessible."
(or (detached-session-localhost-p session)
- (file-remote-p (detached--session-directory session) nil t)))
+ (file-remote-p (detached-session-directory session) nil t)))
(defun detached--watched-session-directory-p (directory)
"Return t if DIRECTORY is being watched."
@@ -1331,8 +1335,8 @@ Optionally make the path LOCAL to host."
(pcase file
('socket ".socket")
('log ".log"))))
- (remote-local-path (file-remote-p (expand-file-name file-name
(detached--session-directory session)) 'localname))
- (full-path (expand-file-name file-name (detached--session-directory
session))))
+ (remote-local-path (file-remote-p (expand-file-name file-name
(detached-session-directory session)) 'localname))
+ (full-path (expand-file-name file-name (detached-session-directory
session))))
(if (and local remote-local-path)
remote-local-path
full-path)))
@@ -1349,7 +1353,7 @@ Optionally make the path LOCAL to host."
(and (detached-session-active-p session)
(not (detached-session-watched-p session))
(detached--watch-session-directory
- (detached--session-directory session))))
+ (detached-session-directory session))))
(defun detached--create-session-directory ()
"Create session directory if it doesn't exist."
@@ -1733,10 +1737,10 @@ log to deduce the end time."
`(,session-directory . ,(file-notify-add-watch
session-directory
'(change)
- #'detached--session-directory-event))
+ #'detached-session-directory-event))
detached--watched-session-directories)))
-(defun detached--session-directory-event (event)
+(defun detached-session-directory-event (event)
"Act on an EVENT in a directory in `detached--watched-session-directories'.
If event is caused by the deletion of a socket, locate the related
@@ -1749,7 +1753,7 @@ session and trigger a state transition."
(session
(or (alist-get id detached--unvalidated-sessions)
(detached--db-get-session id)))
- (session-directory (detached--session-directory session))
+ (session-directory (detached-session-directory session))
(is-primary
(detached--primary-detached-emacs-p session)))
@@ -1765,7 +1769,7 @@ session and trigger a state transition."
(unless
(thread-last (detached--db-get-sessions)
(seq-filter #'detached-session-active-p)
- (seq-map #'detached--session-directory)
+ (seq-map #'detached-session-directory)
(seq-uniq)
(seq-filter (lambda (it) (string= it
session-directory))))
(file-notify-rm-watch
@@ -1788,7 +1792,7 @@ session and trigger a state transition."
(if (detached--state-transition-p session)
(detached--session-state-transition-update session 'approximate)
(detached--db-update-entry session)
- (detached--watch-session-directory (detached--session-directory
session)))
+ (detached--watch-session-directory (detached-session-directory
session)))
(if (detached--session-missing-p session)
(detached--db-remove-entry session)
(detached--db-update-entry session))))
- [elpa] externals/detached 236f6c95af 08/38: Improve implementation, (continued)
- [elpa] externals/detached 236f6c95af 08/38: Improve implementation, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 0ca53e29ff 09/38: Remove error check, ELPA Syncer, 2022/11/17
- [elpa] externals/detached fec1a4c7bd 24/38: Update function signatures, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 473fcc2d43 23/38: Rename detached-session-modes, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 5c212b2609 05/38: Update start-detached-session, ELPA Syncer, 2022/11/17
- [elpa] externals/detached aca448c773 19/38: Revert marks in list when widening, ELPA Syncer, 2022/11/17
- [elpa] externals/detached f70ac98dc5 21/38: Remove dtach--arg dependency, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 18c388bb48 36/38: Update attach shell command, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 88f925ee15 14/38: Add missing string-join, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 4cc2c4e40f 12/38: Add select host session completion function, ELPA Syncer, 2022/11/17
- [elpa] externals/detached d1c3861e8e 16/38: Add public function for session directory,
ELPA Syncer <=
- [elpa] externals/detached ca0ee7e465 37/38: Add detach key to session map, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 274993d9c9 20/38: Remove 'started state, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 51858bceb7 26/38: Begin rework of how to start a session, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 65c661bc9c 27/38: Change detached env to text-mode, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 3dc3651e98 18/38: Add session working directory function, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 88618a9cee 17/38: Add public function for session command, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 4b3609385d 01/38: Start session rewrite, ELPA Syncer, 2022/11/17
- [elpa] externals/detached f0f9728e2c 31/38: Make local predicate private, ELPA Syncer, 2022/11/17
- [elpa] externals/detached 09b37f681c 30/38: Add detached-with-session macro, ELPA Syncer, 2022/11/17
- [elpa] externals/detached a57a728382 22/38: Remove detached-session-mode 'attach, ELPA Syncer, 2022/11/17