branch: externals/dtache commit 5a39733299cae60da2aab0e0b9f559bcc022369f Author: Niklas Eklund <niklas.ekl...@posteo.net> Commit: Niklas Eklund <niklas.ekl...@posteo.net>
Improve output when attaching Fix tests and make functionality work with eshell. Also update the documentation and enable the feature by default. --- CHANGELOG.org | 1 + README.md | 33 +++++++++++++++++---------------- dtache-eshell.el | 5 +++-- dtache.el | 7 ++++--- test/dtache-test.el | 9 +++++---- 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index 41425e0e93..141adc0b90 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -4,6 +4,7 @@ * Development - Add integration with =dired= through =dired-do-shell-command= +- Add option to show a session's output when attaching to a it. This feature is enabled with =dtache-show-output-on-attach=. * Version 0.6 (2022-05-01) diff --git a/README.md b/README.md index b99ff41ce8..e4b58e9705 100644 --- a/README.md +++ b/README.md @@ -229,22 +229,23 @@ Examples of the different sources are featured in this [blog post](https://nikla The package provides the following customizable variables. -| Name | Description | -|------------------------------------|------------------------------------------------------------------------| -| dtache-session-directory | A host specific directory to store sessions in | -| dtache-db-directory | A localhost specific directory to store the database | -| dtache-dtach-program | Name or path to the `dtach` program | -| dtache-shell-program | Name or path to the `shell` that `dtache` should use | -| dtache-timer-configuration | Configuration of the timer that runs on remote hosts | -| dtache-env | Name or path to the `dtache-env` script | -| dtache-annotation-format | A list of annotations that should be present in completion | -| dtache-max-command-length | How many characters should be used when displaying a command | -| dtache-tail-interval | How often `dtache` should refresh the output when tailing | -| dtache-nonattachable-commands | A list of commands that should be considered nonattachable | -| dtache-notification-function | Specifies which function to issue notifications with | -| dtache-detach-key | Specifies which keybinding to use to detach from a session | -| dtache-shell-command-initial-input | Enables latest value in history to be used as initial input | -| dtache-filter-ansi-sequences | Specifies if dtache will use ansi-color to filter out escape sequences | +| Name | Description | +|------------------------------------|---------------------------------------------------------------------------| +| dtache-session-directory | A host specific directory to store sessions in | +| dtache-db-directory | A localhost specific directory to store the database | +| dtache-dtach-program | Name or path to the `dtach` program | +| dtache-shell-program | Name or path to the `shell` that `dtache` should use | +| dtache-timer-configuration | Configuration of the timer that runs on remote hosts | +| dtache-env | Name or path to the `dtache-env` script | +| dtache-annotation-format | A list of annotations that should be present in completion | +| dtache-max-command-length | How many characters should be used when displaying a command | +| dtache-tail-interval | How often `dtache` should refresh the output when tailing | +| dtache-nonattachable-commands | A list of commands that should be considered nonattachable | +| dtache-notification-function | Specifies which function to issue notifications with | +| dtache-detach-key | Specifies which keybinding to use to detach from a session | +| dtache-shell-command-initial-input | Enables latest value in history to be used as initial input | +| dtache-filter-ansi-sequences | Specifies if dtache will use ansi-color to filter out escape sequences | +| dtache-show-output-command | Specifies if dtache should show the session's output when attaching to it | Apart from those variables there is also the different `action` variables, which can be configured differently depending on the origin of the session. diff --git a/dtache-eshell.el b/dtache-eshell.el index e375e028fe..a7edd69d18 100644 --- a/dtache-eshell.el +++ b/dtache-eshell.el @@ -114,10 +114,11 @@ If prefix-argument directly DETACH from the session." (mapconcat #'identity (flatten-list args) " "))) - (session (dtache-create-session command))) + (session (dtache-create-session command)) + (command (dtache-dtach-command session))) (setq dtache--buffer-session session) (setq dtache-enabled nil) - (apply orig-fun `(,dtache-dtach-program ,(dtache-dtach-command session)))) + (apply orig-fun `(,(seq-first command) ,(seq-rest command)))) (apply orig-fun args))) ;;;; Minor mode diff --git a/dtache.el b/dtache.el index d77716399e..802eee6538 100644 --- a/dtache.el +++ b/dtache.el @@ -77,7 +77,7 @@ :type 'string :group 'dtache) -(defcustom dtache-show-output-on-attach nil +(defcustom dtache-show-output-on-attach t "If set to t show the session output when attaching to it." :type 'bool :group 'dtache) @@ -809,7 +809,7 @@ Optionally CONCAT the command return command into a string." (append (when dtache-show-output-on-attach `(,dtache-show-output-command ,(concat log ";"))) - `(,dtach-arg ,socket "-r" "none"))) + `(,dtache-dtach-program ,dtach-arg ,socket "-r" "none"))) (if concat (mapconcat #'identity `(,dtache-dtach-program @@ -818,7 +818,8 @@ Optionally CONCAT the command return command into a string." ,dtache-shell-program "-c" ,(shell-quote-argument (dtache--dtache-command session))) " ") - `(,dtach-arg ,socket "-z" + `(,dtache-dtach-program + ,dtach-arg ,socket "-z" ,dtache-shell-program "-c" ,(dtache--dtache-command session))))))) diff --git a/test/dtache-test.el b/test/dtache-test.el index 9ea9011353..2cfb82b381 100644 --- a/test/dtache-test.el +++ b/test/dtache-test.el @@ -77,7 +77,8 @@ (lambda (_) session))) (let* ((dtache-session-mode 'create-and-attach) - (expected `("-c" ,(dtache--session-file session 'socket t) + (expected `(,dtache-dtach-program + "-c" ,(dtache--session-file session 'socket t) "-z" ,dtache-shell-program "-c" ,(format "{ dtache-env ls\\ -la; } 2>&1 | tee %s" @@ -92,9 +93,9 @@ (should (equal expected (dtache-dtach-command session))) (should (equal expected-concat (dtache-dtach-command session t)))) (let* ((dtache-session-mode 'attach) - (expected `("-a" ,(dtache--session-file session 'socket t) "-r" "none" - ,dtache-show-output-command - ,(format "%s;" (dtache--session-file session 'log t)))) + (expected `(,dtache-show-output-command + ,(format "%s;" (dtache--session-file session 'log t)) + ,dtache-dtach-program "-a" ,(dtache--session-file session 'socket t) "-r" "none")) (expected-concat (format "%s %s; %s -a %s -r none" dtache-show-output-command (dtache--session-file session 'log t)