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

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

[elpa] externals/dtache ca489920f3 1/2: Add support for dired


From: ELPA Syncer
Subject: [elpa] externals/dtache ca489920f3 1/2: Add support for dired
Date: Wed, 11 May 2022 16:57:27 -0400 (EDT)

branch: externals/dtache
commit ca489920f31683e9c339ac57a99f260c2625266e
Author: Rose Osterheld <dev@roeli.org>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    Add support for dired
    
    Add a function to the README that lets dtache be used for asynchronous
    shell commands with dired while still supporting all of dired's
    filename substitution features.
---
 CHANGELOG.org |  1 +
 README.md     | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/CHANGELOG.org b/CHANGELOG.org
index ab475ca3f2..41425e0e93 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -3,6 +3,7 @@
 #+language: en
 
 *   Development
+- Add integration with =dired= through =dired-do-shell-command=
 
 * Version 0.6 (2022-05-01)
 
diff --git a/README.md b/README.md
index 4fed7d7b03..b99ff41ce8 100644
--- a/README.md
+++ b/README.md
@@ -430,6 +430,23 @@ The package can be integrated with the 
[vterm](https://github.com/akermu/emacs-l
     (process-send-string vterm--process dtache--dtach-detach-character)))
 ```
 
+### Dired
+
+Dtache can be used to run async commands in `dired`, with all of dired's 
special features for inserting filenames an working with marked files.
+
+``` emacs-lisp
+(defun my/dtache-dired-do-shell-command (dired-do-shell-command &rest args)
+  "Make sure `dtache' is used before running DIRED-DO-SHELL-COMMAND with ARGS."
+  (cl-letf* ((dtache-session-origin 'dired)
+             ((symbol-function #'dired-run-shell-command)
+              (lambda (command)
+                (dtache-start-session command)
+                nil)))
+    (apply dired-do-shell-command args)))
+
+(advice-add 'dired-do-shell-command :around #'my/dtache-dired-do-shell-command)
+```
+
 ### Dired-rsync
 
 The [dired-rsync](https://github.com/stsquad/dired-rsync) is a package to run 
[rsync](https://linux.die.net/man/1/rsync) commands from within `dired`. Its a 
perfect package to integrate with `dtache` since it typically requires some 
time to run and you don't want to have your Emacs limited by that process.



reply via email to

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