branch: externals/dtache
commit 79f1d905a92b802edbf270e28d8c7e8bf2f2a776
Author: Niklas Eklund <[email protected]>
Commit: Niklas Eklund <[email protected]>
Add example of how to enhance a command with dtach
---
README.org | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/README.org b/README.org
index 8387cba06f..15cc914175 100644
--- a/README.org
+++ b/README.org
@@ -306,6 +306,19 @@ The =dtache= package supports
[[https://www.gnu.org/software/emacs/manual/html_n
(connection-local-set-profiles
'(:application tramp :protocol "ssh") 'remote-dtache)
#+end_src
+** Enhance a command with dtache
+
+A part from the extensions provided with this package the users of =dtache=
can leverage the package to instruct other commands to use =dtache=. Here is an
example where the package =dired-rsync= is modified to utilize =dtache=.
+
+#+begin_src elisp
+ (defun my/dtache-dired-rsync-advice (orig-fun &rest args)
+ "Always run `dired-rsync' with `dtache'."
+ (pcase-let* ((`(,command ,details) args)
+ (dtache--dtach-mode 'new))
+ (apply orig-fun `(,(dtache-dtach-command command t) ,details))))
+
+ (advice-add #'dired-rsync--do-run :around #'my/dtache-dired-rsync-advice)
+#+end_src
** Customize an individual session