branch: externals/detached commit 88618a9ceec298b5dd7a34ba5b310ba5f6ed2aae Author: Niklas Eklund <niklas.ekl...@posteo.net> Commit: Niklas Eklund <niklas.ekl...@posteo.net>
Add public function for session command --- detached-compile.el | 6 +++--- detached-extra.el | 4 ++-- detached-list.el | 12 ++++++------ detached.el | 28 ++++++++++++++-------------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/detached-compile.el b/detached-compile.el index 616d7b069c..000d4d0021 100644 --- a/detached-compile.el +++ b/detached-compile.el @@ -89,7 +89,7 @@ Optionally EDIT-COMMAND." (detached-current-session session) (detached-local-session (detached-session-local-p session)) (default-directory (detached-session-directory session))) - (compilation-start (detached--session-command session))))) + (compilation-start (detached-session-command session))))) ;;;;; Support functions @@ -99,7 +99,7 @@ Optionally EDIT-COMMAND." (when detached-enabled (setq-local default-directory (detached--session-working-directory detached-current-session)) (setq detached-buffer-session detached-current-session) - (setq compile-command (detached--session-command detached-current-session)) + (setq compile-command (detached-session-command detached-current-session)) (setq compilation-arguments nil) (detached-compile--replace-modesetter) (when detached-filter-ansi-sequences @@ -131,7 +131,7 @@ Optionally EDIT-COMMAND." (goto-char (point-min)) (when (re-search-forward regexp nil t) (delete-region (match-beginning 0) (match-end 0)) - (insert (detached--session-command detached-current-session)))))) + (insert (detached-session-command detached-current-session)))))) (defun detached-compile--compilation-detached-filter () "Filter to modify the output in a compilation buffer." diff --git a/detached-extra.el b/detached-extra.el index c73f0aecab..20270666ad 100644 --- a/detached-extra.el +++ b/detached-extra.el @@ -27,7 +27,7 @@ (declare-function detached-compile "detached") (declare-function detached-start-session "detached") -(declare-function detached--session-command "detached") +(declare-function detached-session-command "detached") (declare-function alert "alert") @@ -58,7 +58,7 @@ Optionally USE-COMINT-MODE" "Send an `alert' notification when SESSION becomes inactive." (let ((status (detached-session-status session)) (host (detached-session-host-name session))) - (alert (detached--session-command session) + (alert (detached-session-command session) :title (pcase status ('success (format "Detached finished [%s]" host)) ('failure (format "Detached failed [%s]" host))) diff --git a/detached-list.el b/detached-list.el index 7c7f5f1c27..309671a22e 100644 --- a/detached-list.el +++ b/detached-list.el @@ -100,7 +100,7 @@ detached list implements." (goto-char (point-min)) (while (not (eobp)) (let ((session (tabulated-list-get-id))) - (push `(,(detached--session-command session) . ,(point)) + (push `(,(detached-session-command session) . ,(point)) index)) (forward-line 1)) (seq-reverse index))) @@ -111,7 +111,7 @@ detached list implements." (when (detached-session-p session) (let ((strs `(,(when-let ((annotation (detached--session-annotation session))) (propertize annotation 'face 'detached-annotation-face)) - ,(detached--session-command session)))) + ,(detached-session-command session)))) (string-join (seq-remove #'null strs) "\n"))))) ;;;; Commands @@ -383,7 +383,7 @@ Optionally TOGGLE-SUPPRESS-OUTPUT." (list (if current-prefix-arg (regexp-quote - (detached--session-command + (detached-session-command (detached--get-session major-mode))) (read-regexp "Filter session commands containing (regexp): ")))) @@ -394,7 +394,7 @@ Optionally TOGGLE-SUPPRESS-OUTPUT." ,(lambda (sessions) (seq-filter (lambda (it) (string-match regexp - (detached--session-command it))) + (detached-session-command it))) sessions))))))) (defun detached-list-narrow-working-directory (regexp) @@ -570,7 +570,7 @@ If prefix-argument is provided unmark instead of mark." (goto-char (point-min)) (while (not (eobp)) (let ((session (tabulated-list-get-id))) - (when (string-match regexp (detached--session-command session)) + (when (string-match regexp (detached-session-command session)) (if current-prefix-arg (detached-list--unmark-session session) (detached-list--mark-session session)))) @@ -820,7 +820,7 @@ If prefix-argument is provided unmark instead of mark." (defun detached-list--command-str (session) "Return command string for SESSION." - (let ((command-str (detached--session-command session))) + (let ((command-str (detached-session-command session))) (if (detached-session-uninitialized-p session) (propertize command-str 'face 'detached-uninitialized-face) command-str))) diff --git a/detached.el b/detached.el index dace040160..c09c4ff134 100644 --- a/detached.el +++ b/detached.el @@ -480,7 +480,7 @@ The session is compiled by opening its output and enabling (detached--session-initial-mode session))) (detached-session-action (detached--session-action session)) (command - (read-string "Edit command: " (detached--session-command session)))) + (read-string "Edit command: " (detached-session-command session)))) (if suppress-output (detached-start-session command suppress-output) (funcall (detached-session-run-function session) command))))) @@ -498,7 +498,7 @@ The session is compiled by opening its output and enabling (detached-session-mode (or detached-session-mode (detached--session-initial-mode session))) (detached-session-action (detached--session-action session)) - (command (detached--session-command session))) + (command (detached-session-command session))) (if suppress-output (detached-start-session command suppress-output) (funcall (detached-session-run-function session) command))))) @@ -547,7 +547,7 @@ The session is compiled by opening its output and enabling "Copy SESSION's command." (interactive (list (detached-completing-read (detached-get-sessions)))) - (kill-new (detached--session-command session))) + (kill-new (detached-session-command session))) ;;;###autoload (defun detached-insert-session-command (session) @@ -555,7 +555,7 @@ The session is compiled by opening its output and enabling (interactive (list (detached-completing-read (detached-get-sessions)))) (when (detached-valid-session session) - (insert (detached--session-command session)))) + (insert (detached-session-command session)))) ;;;###autoload (defun detached-delete-session (session) @@ -753,7 +753,7 @@ Optionally SUPPRESS-OUTPUT." (detached--annotation-widths sessions detached-annotation-format)) (let ((command-length (thread-last sessions - (seq-map #'detached--session-command) + (seq-map #'detached-session-command) (seq-map #'length) (seq-max) (min (plist-get detached-command-format :width))))) @@ -854,7 +854,7 @@ This function uses the echo area." (let ((status (pcase (detached-session-status session) ('success "Detached finished") ('failure "Detached failed")))) - (message "%s [%s]: %s" status (detached-session-host-name session) (detached--session-command session)))) + (message "%s [%s]: %s" status (detached-session-host-name session) (detached-session-command session)))) (defun detached-state-transition-notifications-message (session) "Issue a notification when SESSION transitions from active to inactive. @@ -865,7 +865,7 @@ This function uses the `notifications' library." :title (pcase status ('success (format "Detached finished [%s]" host)) ('failure (format "Detached failed [%s]" host))) - :body (detached--session-command session) + :body (detached-session-command session) :urgency (pcase status ('success 'normal) ('failure 'critical))))) @@ -1064,7 +1064,7 @@ This function uses the `notifications' library." (defun detached-session-identifier (session) "Return SESSION's identifier string." (string-join - `(,(detached--session-command session) + `(,(detached-session-command session) ,(detached--host-str session) ,(detached-session-directory session)) ", ")) @@ -1219,13 +1219,13 @@ This function uses the `notifications' library." (defun detached-command-str (session max-length) "Return SESSION's command as a string restrict it to MAX-LENGTH." - (let ((command (detached--session-command session))) + (let ((command (detached-session-command session))) (if (<= (length command) max-length) (truncate-string-to-width command max-length 0 ?\s) - (concat (substring (detached--session-command session) 0 (- max-length 3)) "...")))) + (concat (substring (detached-session-command session) 0 (- max-length 3)) "...")))) ;;;; Support functions @@ -1264,7 +1264,7 @@ This function uses the `notifications' library." (defun detached--session-header (session) "Return header for SESSION." (string-join - `(,(format "Command: %s" (detached--session-command session)) + `(,(format "Command: %s" (detached-session-command session)) ,(format "Working directory: %s" (detached--working-dir-str session)) ,(format "Host: %s" (detached-session-host-name session)) ,(format "Id: %s" (symbol-name (detached-session-id session))) @@ -1670,8 +1670,8 @@ If SESSION is degraded fallback to a command that doesn't rely on tee." (format "TERM=eterm-color %s" (format (detached--get-terminal-data-command) - (detached--session-command session))) - (detached--session-command session)))))) + (detached-session-command session))) + (detached-session-command session)))))) (format "%s %s %s; %s %s" begin-shell-group shell command end-shell-group redirect))) (defun detached--get-terminal-data-command () @@ -2012,7 +2012,7 @@ Optionally CONCAT the command return command into a string." ((eq 'create-and-attach detached-session-mode) (let ((detached-session-mode 'create) (detached-current-session session)) - (detached-start-session (detached--session-command session)) + (detached-start-session (detached-session-command session)) (if concat (string-join tail-command " ") tail-command)))