[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/detached e02efdbfd8 2/2: Add describe session command
From: |
ELPA Syncer |
Subject: |
[elpa] externals/detached e02efdbfd8 2/2: Add describe session command |
Date: |
Thu, 13 Oct 2022 09:57:33 -0400 (EDT) |
branch: externals/detached
commit e02efdbfd87580907b847d5d069a40dd6520a23b
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Add describe session command
Useful when one want to get the full description of a session in
different contexts.
---
CHANGELOG.org | 1 +
detached-compile.el | 1 +
detached-eshell.el | 1 +
detached-list.el | 5 +++++
detached-vterm.el | 1 +
detached.el | 14 ++++++++++++++
6 files changed, 23 insertions(+)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index 2fa159c202..dfccbb8586 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -14,6 +14,7 @@
- Implement mode-line indicator for criteria in =detached-list=
- Add command for initializing a session directory
- Add integration with =nano-modeline=
+- Add =detached-describe-session= command
* Version 0.9.1 (2022-09-22)
diff --git a/detached-compile.el b/detached-compile.el
index 4d8df41ba9..43d03e9a32 100644
--- a/detached-compile.el
+++ b/detached-compile.el
@@ -158,6 +158,7 @@ Optionally EDIT-COMMAND."
(defvar detached-compilation-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c C-k") #'detached-compile-kill)
+ (define-key map (kbd "C-c C-.") #'detached-describe-session)
(define-key map (kbd detached-detach-key) #'detached-detach-session)
map)
"Keymap for `detached-compilation-mode'.")
diff --git a/detached-eshell.el b/detached-eshell.el
index a6cdd596c1..7c3b22ce32 100644
--- a/detached-eshell.el
+++ b/detached-eshell.el
@@ -125,6 +125,7 @@ If prefix-argument directly DETACH from the session."
(let ((map (make-sparse-keymap)))
(define-key map (kbd "<S-return>") #'detached-eshell-send-input)
(define-key map (kbd "<C-return>") #'detached-eshell-attach-session)
+ (define-key map (kbd "C-c C-.") #'detached-describe-session)
(define-key map (kbd detached-detach-key) #'detached-detach-session)
map)
"Keymap for `detached-eshell-mode'.")
diff --git a/detached-list.el b/detached-list.el
index ed25896877..517f31e2f1 100644
--- a/detached-list.el
+++ b/detached-list.el
@@ -644,6 +644,10 @@ If prefix-argument is provided unmark instead of mark."
detached-list--filters)
sessions))
+(cl-defmethod detached--get-session ((_mode (derived-mode detached-list-mode)))
+ "Return session when in `detached-list-mode'."
+ (tabulated-list-get-id))
+
;;;; Major mode
(defvar detached-list-mode-map
@@ -680,6 +684,7 @@ If prefix-argument is provided unmark instead of mark."
(define-key map (kbd "=") #'detached-list-diff-marked-sessions)
(define-key map (kbd "-") #'detached-list-widen)
(define-key map (kbd "!") #'detached-shell-command)
+ (define-key map (kbd ".") #'detached-describe-session)
(define-key map (kbd "<backspace>")
#'detached-list-remove-narrow-criterion)
(define-key map (kbd "<return>") #'detached-list-open-session)
map)
diff --git a/detached-vterm.el b/detached-vterm.el
index 138c8ae77f..268e15df5c 100644
--- a/detached-vterm.el
+++ b/detached-vterm.el
@@ -95,6 +95,7 @@ Optionally DETACH from it."
(let ((map (make-sparse-keymap)))
(define-key map (kbd "<S-return>") #'detached-vterm-send-input)
(define-key map (kbd "<C-return>") #'detached-vterm-attach)
+ (define-key map (kbd "C-c C-.") #'detached-describe-session)
(define-key map (kbd detached-detach-key) #'detached-detach-session)
map)
"Keymap for `detached-vterm-mode'.")
diff --git a/detached.el b/detached.el
index fef8f3ec42..d1828972c7 100644
--- a/detached.el
+++ b/detached.el
@@ -462,6 +462,14 @@ The session is compiled by opening its output and enabling
(funcall run-fun command)
(detached-start-session command))))))
+(defun detached-describe-session ()
+ "Describe current session."
+ (interactive)
+ (when-let ((session (detached--get-session major-mode)))
+ (message
+ (string-trim
+ (detached--session-header session)))))
+
;;;###autoload
(defun detached-attach-session (session)
"Attach to SESSION."
@@ -858,6 +866,10 @@ This function uses the `notifications' library."
;;;;; Other
+(cl-defgeneric detached--get-session (_mode)
+ "Return session."
+ detached--buffer-session)
+
(cl-defgeneric detached--shell-command (entity &optional concat)
"Return shell command for ENTITY optionally CONCAT.")
@@ -1670,6 +1682,7 @@ If event is cased by an update to the `detached'
database, re-initialize
(defvar detached-shell-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd detached-detach-key) #'detached-detach-session)
+ (define-key map (kbd "C-c C-.") #'detached-describe-session)
map)
"Keymap for `detached-shell-mode'.")
@@ -1690,6 +1703,7 @@ If event is cased by an update to the `detached'
database, re-initialize
(defvar detached-log-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd detached-detach-key) #'detached-detach-session)
+ (define-key map (kbd "C-c C-.") #'detached-describe-session)
map)
"Keymap for `detached-log-mode'.")