[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/detached c5aefccb97 4/6: Use context instead of show ou
From: |
ELPA Syncer |
Subject: |
[elpa] externals/detached c5aefccb97 4/6: Use context instead of show output |
Date: |
Fri, 3 Jun 2022 03:57:32 -0400 (EDT) |
branch: externals/detached
commit c5aefccb97e3dcb49d41340d30ce2cc6eec940a8
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Use context instead of show output
---
README.md | 8 ++------
detached.el | 32 ++++++++++++++++++++------------
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index 91a501ab0b..bc4bdee79c 100644
--- a/README.md
+++ b/README.md
@@ -241,13 +241,9 @@ Users can customize the appearance of annotations in
`detached-open-session` by
"The format of the annotations.")
```
-## Show session output when attaching
+## Show session context when attaching
-By default the `detached-show-output-on-attach` is set to nil. However if the
user enables this feature it means that all the output from a session will be
shown when attaching to a session. To be able to do this the
`detached-show-output-command` is used. This is set to use `cat` to display the
output. Many times with long sessions showing all the output might not be
necessary, or desirable. A good alternative is then to use `tail` as the
command. For example by showing the last 50 line [...]
-
-``` emacs-lisp
-(setq detached-show-output-command "tail --lines=50")
-```
+By default the `detached-show-session-context` is set to t. This means that
part of the output from a session will be shown when attaching to a session.
The number of lines of the context is determined by
`detached-session-context-lines`. The package uses `tail` in order to display
the context.
## Metadata annotators
diff --git a/detached.el b/detached.el
index 4b93fef177..84a7275ad9 100644
--- a/detached.el
+++ b/detached.el
@@ -68,7 +68,12 @@
:group 'detached)
(defcustom detached-dtach-program "dtach"
- "The name of the `dtach' program."
+ "The name of the dtach program."
+ :type 'string
+ :group 'detached)
+
+(defcustom detached-tail-program "tail"
+ "The name of the tail program."
:type 'string
:group 'detached)
@@ -77,14 +82,14 @@
:type 'string
:group 'detached)
-(defcustom detached-show-output-on-attach nil
- "If set to t show the session output when attaching to it."
- :type 'bool
+(defcustom detached-session-context-lines 50
+ "Number of context lines to display for a session."
+ :type 'string
:group 'detached)
-(defcustom detached-show-output-command (executable-find "cat")
- "The command to be run to show a sessions output."
- :type 'string
+(defcustom detached-show-session-context t
+ "If session context should be shown when attaching."
+ :type 'boolean
:group 'detached)
(defcustom detached-terminal-data-command "script --quiet --flush --return
--command \"%s\" /dev/null"
@@ -795,7 +800,9 @@ Optionally CONCAT the command return command into a string."
Optionally CONCAT the command return command into a string."
(detached-connection-local-variables
(let* ((log (detached--session-file session 'log t))
- (tail-command `("tail" "--follow=name" "--retry" "--lines=50" ,log)))
+ (tail-command `(,detached-tail-program "--follow=name" "--retry"
+ ,(concat "--lines="
detached-session-context-lines)
+ ,log)))
(cond ((eq 'create detached-session-mode)
(detached-dtach-command session))
((eq 'create-and-attach detached-session-mode)
@@ -831,16 +838,17 @@ Optionally CONCAT the command return command into a
string."
(if (eq detached-session-mode 'attach)
(if concat
(mapconcat #'identity
- `(,(when detached-show-output-on-attach
- (concat detached-show-output-command " " log ";"))
+ `(,(when detached-show-session-context
+ (format "%s --lines=%s %s;"
detached-tail-program detached-session-context-lines log))
,detached-dtach-program
,dtach-arg
,socket
"-r none")
" ")
(append
- (when detached-show-output-on-attach
- `(,detached-show-output-command ,(concat log ";")))
+ (when detached-show-session-context
+ `(,detached-tail-program ,(concat "--lines="
detached-session-context-lines)
+ ,(concat log ";")))
`(,detached-dtach-program ,dtach-arg ,socket "-r" "none")))
(if concat
(mapconcat #'identity
- [elpa] externals/detached updated (6e7a236fa5 -> 670433a5ab), ELPA Syncer, 2022/06/03
- [elpa] externals/detached c5aefccb97 4/6: Use context instead of show output,
ELPA Syncer <=
- [elpa] externals/detached 492223d576 2/6: Rename non-attachable to degraded session, ELPA Syncer, 2022/06/03
- [elpa] externals/detached 201de1eb65 3/6: Update CHANGELOG, ELPA Syncer, 2022/06/03
- [elpa] externals/detached 9a00a50971 1/6: Introduce usage of tail for degraded sessions, ELPA Syncer, 2022/06/03
- [elpa] externals/detached 28e3eb5b6a 5/6: Update tests, ELPA Syncer, 2022/06/03
- [elpa] externals/detached 670433a5ab 6/6: Merge branch 'new-tailing', ELPA Syncer, 2022/06/03