From d40903f488306fa0688ba721edd4fb3ead4be352 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Wed, 19 Jul 2017 03:13:28 +0100 Subject: [PATCH] el/dot-emacs.el: Add hack for running programs from Dired buffers. Organization: Straylight/Edgeware From: Mark Wooding Idea from Ian Jackson's dotfiles. --- el/dot-emacs.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 59f47f2..769686c 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -768,6 +768,17 @@ (defadvice dired-maybe-insert-subdir (ad-set-arg 0 dir) ad-do-it))) +(defun mdw-dired-run (args &optional syncp) + (interactive (let ((file (dired-get-filename t))) + (list (read-string (format "Arguments for %s: " file)) + current-prefix-arg))) + (funcall (if syncp 'shell-command 'async-shell-command) + (concat (shell-quote-argument (dired-get-filename nil)) + " " args))) + +(eval-after-load "dired" + '(define-key dired-mode-map "X" 'mdw-dired-run)) + ;;;-------------------------------------------------------------------------- ;;; URL viewing. -- [mdw]