emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dtache 79f1d905a9 078/158: Add example of how to enhanc


From: ELPA Syncer
Subject: [elpa] externals/dtache 79f1d905a9 078/158: Add example of how to enhance a command with dtach
Date: Wed, 19 Jan 2022 18:57:59 -0500 (EST)

branch: externals/dtache
commit 79f1d905a92b802edbf270e28d8c7e8bf2f2a776
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    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
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]