Emacs - dired open file
authorPeng Li <seudut@gmail.com>
Fri, 29 Sep 2017 01:20:21 +0000 (09:20 +0800)
committerPeng Li <seudut@gmail.com>
Fri, 29 Sep 2017 01:20:21 +0000 (09:20 +0800)
emacs.d/config.org

index 7ebbe01..0854ef8 100644 (file)
@@ -2028,7 +2028,7 @@ here on Mac, just use "open" commands to pen =.pdf=,  =.html= and image files
           ("\\.csv\\'" "libreoffice")
           ("\\.tex\\'" "pdflatex" "latex")
           ("\\.\\(?:mp4\\|mkv\\|avi\\|rmvb\\|flv\\|ogv\\)\\(?:\\.part\\)?\\'" "mplayer")
-          ("\\.\\(?:mp3\\|flac\\)\\'" "rhythmbox")
+          ("\\.\\(?:mp3\\|flac\\|wav\\)\\'" "mplayer")
           ("\\.html?\\'" "open")
           ("\\.dmg\\'" "open")
           ("\\.cue?\\'" "audacious")))
@@ -2036,30 +2036,27 @@ here on Mac, just use "open" commands to pen =.pdf=,  =.html= and image files
 
   (defun sd/dired-start-process (cmd &optional file-list)
     (interactive
-     (let ((files (dired-get-marked-files
-                   t current-prefix-arg)))
+     (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))
+        (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 "\" \""))))))
+    ;; (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