From 59bb73d87061e380f86ce1f9aff27d4a74bdcf61 Mon Sep 17 00:00:00 2001 From: bard Date: Fri, 17 May 2024 06:13:15 -0400 Subject: Feat: dired-do-command function to run commands on dired files --- bard-emacs-modules/bard-emacs-dired.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 "") #'image-dired-thumbnail-display-external) -- cgit v1.2.3