branch: externals/detached commit a15b46d32f0518e567c18637dfe69d16e8358187 Author: Niklas Eklund <niklas.ekl...@posteo.net> Commit: Niklas Eklund <niklas.ekl...@posteo.net>
Merge copy and annotation commands --- README.md | 2 +- detached-init.el | 4 ++-- detached-list.el | 27 ++------------------------- detached.el | 17 +++++++++++++++-- 4 files changed, 20 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 9cff19e1c9..8332374169 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ The package also provides additional commands to interact with a session. | detached-rerun-session (r) | Rerun a session | | detached-insert-session-command (i) | Insert the session's command at point | | detached-copy-session-command (w) | Copy the session's shell command | -| detached-copy-session (W) | Copy the session's output | +| detached-copy-session-output (W) | Copy the session's output | | detached-kill-session (k) | Kill an active session | | detached-delete-session (d) | Delete an inactive session | diff --git a/detached-init.el b/detached-init.el index efc98d437d..aa8e4dede5 100644 --- a/detached-init.el +++ b/detached-init.el @@ -36,7 +36,7 @@ (declare-function detached-rerun-session "detached") (declare-function detached-view-session "detached") (declare-function detached-copy-session-command "detached") -(declare-function detached-copy-session "detached") +(declare-function detached-copy-session-output "detached") (declare-function detached-diff-session "detached") (declare-function detached-initialize-sessions "detached") (declare-function detached-shell-mode "detached") @@ -89,7 +89,7 @@ (define-key map "r" #'detached-rerun-session) (define-key map "v" #'detached-view-session) (define-key map "w" #'detached-copy-session-command) - (define-key map "W" #'detached-copy-session) + (define-key map "W" #'detached-copy-session-output) (define-key map "=" #'detached-diff-session) map)) diff --git a/detached-list.el b/detached-list.el index d419559c49..7a817e1e62 100644 --- a/detached-list.el +++ b/detached-list.el @@ -144,17 +144,6 @@ Optionally initialize ALL session-directories." (detached-list--initialize-directory directory))) (message "All session directories have been initialized"))) -(defun detached-list-edit-annotation (session) - "Edit SESSION's annotation." - (interactive - (list (tabulated-list-get-id))) - (when-let* ((initial-value (or - (detached--session-annotation session) - "")) - (annotation (read-string "Annotation: " initial-value))) - (setf (detached--session-annotation session) annotation) - (detached--db-update-entry session))) - (defun detached-list-quit () "Quit command." (interactive) @@ -192,18 +181,6 @@ Optionally initialize ALL session-directories." (list (tabulated-list-get-id))) (detached-open-session-directory session)) -(defun detached-list-copy-session-command (session) - "Copy SESSION at point's command." - (interactive - (list (tabulated-list-get-id))) - (detached-copy-session-command session)) - -(defun detached-list-copy-session-output (session) - "Copy SESSION at point's output." - (interactive - (list (tabulated-list-get-id))) - (detached-copy-session session)) - (defun detached-list-kill-session () "Send a TERM signal to sessions at point, or all marked sessions. @@ -893,7 +870,7 @@ If prefix-argument is provided unmark instead of mark." (defvar detached-list-mode-map (let ((map (make-sparse-keymap))) - (define-key map (kbd "a") #'detached-list-edit-annotation) + (define-key map (kbd "a") #'detached-edit-session-annotation) (define-key map (kbd "d") #'detached-list-delete-session) (define-key map (kbd "e") #'detached-edit-and-run-session) (define-key map (kbd "f") #'detached-list-select-filter) @@ -930,7 +907,7 @@ If prefix-argument is provided unmark instead of mark." (define-key map (kbd "U") #'detached-list-unmark-sessions) (define-key map (kbd "v") #'detached-list-view-session) (define-key map (kbd "w") #'detached-copy-session-command) - (define-key map (kbd "W") #'detached-copy-session) + (define-key map (kbd "W") #'detached-copy-session-output) (define-key map (kbd "x") #'detached-list-detach-from-session) (define-key map (kbd "%") #'detached-list-mark-regexp) (define-key map (kbd "=") #'detached-list-diff-marked-sessions) diff --git a/detached.el b/detached.el index 84a3e0d3c8..d13fb5a8aa 100644 --- a/detached.el +++ b/detached.el @@ -229,10 +229,11 @@ If set to a non nil value the latest entry to (defvar detached-session-map (let ((map (make-sparse-keymap))) + (define-key map "a" #'detached-edit-session-annotation) (define-key map "e" #'detached-edit-and-run-session) (define-key map "r" #'detached-rerun-session) (define-key map "w" #'detached-copy-session-command) - (define-key map "W" #'detached-copy-session) + (define-key map "W" #'detached-copy-session-output) map)) (defvar detached-enabled nil) @@ -500,6 +501,18 @@ The session is compiled by opening its output and enabling (select-window (display-buffer buffer-name detached-open-session-display-buffer-action)))))) +;;;###autoload +(defun detached-edit-session-annotation (session) + "Edit SESSION's annotation." + (interactive + (list (detached-session-in-context))) + (when-let* ((initial-value (or + (detached--session-annotation session) + "")) + (annotation (read-string "Annotation: " initial-value))) + (setf (detached--session-annotation session) annotation) + (detached--db-update-entry session))) + ;;;###autoload (defun detached-edit-and-run-session (session &optional toggle-session-mode) "Edit and re-run SESSION at point. @@ -570,7 +583,7 @@ Optionally TOGGLE-SESSION-MODE." initialized-session))))) ;;;###autoload -(defun detached-copy-session (session) +(defun detached-copy-session-output (session) "Copy SESSION's output." (interactive (list (detached-session-in-context)))