aboutsummaryrefslogtreecommitdiff
path: root/bard-emacs-modules/bard-emacs-dired.el
diff options
context:
space:
mode:
authorbard <[email protected]>2024-05-17 06:13:15 -0400
committerbard <[email protected]>2024-05-17 06:13:15 -0400
commit59bb73d87061e380f86ce1f9aff27d4a74bdcf61 (patch)
treebdc2379a0378abf9baf43f0bd4db08c327a94de9 /bard-emacs-modules/bard-emacs-dired.el
parentd0d38d77615068fbc09f00dee8cce1146cdbc150 (diff)
Feat: dired-do-command
function to run commands on dired files
Diffstat (limited to 'bard-emacs-modules/bard-emacs-dired.el')
-rw-r--r--bard-emacs-modules/bard-emacs-dired.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/bard-emacs-modules/bard-emacs-dired.el b/bard-emacs-modules/bard-emacs-dired.el
index 05910b6..f8d7529 100644
--- a/bard-emacs-modules/bard-emacs-dired.el
+++ b/bard-emacs-modules/bard-emacs-dired.el
@@ -37,6 +37,18 @@
(setq image-dired-thumb-relief 0)
(setq image-dired-thumbs-per-row 4)
+;; Taken from https://superuser.com/a/176629
+(defun bard/dired-do-command (command)
+ "Run COMMAND on marked files. Any files not already open will be opened.
+After this command has been run, any buffers it's modified will remain
+open and unsaved."
+ (interactive "CRun on marked files M-x ")
+ (save-window-excursion
+ (mapc (lambda (filename)
+ (find-file filename)
+ (call-interactively command))
+ (dired-get-marked-files))))
+
;; (define-key image-dired-thumbnail-mode-map
;; (kbd "<return>") #'image-dired-thumbnail-display-external)