From: Peng Li Date: Tue, 2 Aug 2016 11:50:33 +0000 (+0800) Subject: emacs - dired start process X-Git-Url: http://47.100.26.94:8080/?a=commitdiff_plain;h=e4cdf10258135595a323f282cce4b27407f9aaa1;p=dotfiles.git emacs - dired start process --- diff --git a/emacs.d/config.org b/emacs.d/config.org index 4bae6f0..c35e2fe 100644 --- a/emacs.d/config.org +++ b/emacs.d/config.org @@ -1545,6 +1545,34 @@ here on Mac, just use "open" commands to pen =.pdf=, =.html= and image files ("\\.html?\\'" "open") ("\\.dmg\\'" "open") ("\\.cue?\\'" "audacious"))) + + + (defun sd/dired-start-process (cmd &optional file-list) + (interactive + (let ((files (dired-get-marked-files + t current-prefix-arg))) + (list + (unless (eq system-type 'windows-nt) + (dired-read-shell-command "& on %s: " + current-prefix-arg files)) + files))) + + (if (eq system-type 'windows-nt) + (dolist (file file-list) + (w32-shell-execute "open" (expand-file-name file))) + (let (list-switch) + (start-process + cmd nil shell-file-name + shell-command-switch + (format + "nohup 1>/dev/null 2>/dev/null %s \"%s\"" + cmd + ;; (if (and (> (length file-list) 1) + ;; (setq list-switch + ;; (cadr (assoc cmd ora-dired-filelist-cmd)))) + ;; (format "%s %s" cmd list-switch) + ;; cmd) + (mapconcat #'expand-file-name file-list "\" \"")))))) #+END_SRC ** dired-hacks