Anonymous avatar Anonymous committed 402f0b8

preliminary windows support

Comments (0)

Files changed (1)

 string."
   (concat "\\." (regexp-opt strings) "$"))
 
-(defun openwith-open (command arglist)
+(defun openwith-open-unix (command arglist)
   "Run external command COMMAND, in such a way that it is
   disowned from the parent Emacs process.  If Emacs dies, the
   process spawned here lives on.  ARGLIST is a list of strings,
   each an argument to COMMAND."
   (let ((shell-file-name "/bin/sh"))
     (start-process-shell-command
+     (concat
+      "exec nohup " command " " 
+      (mapconcat 'shell-quote-argument arglist " ")
+      (" >/dev/null"))
      "openwith-process" nil
-     (concat "exec nohup " command " "
-             (mapconcat 'shell-quote-argument arglist " ")
-             " >/dev/null"))))
+     )))
+
+(defun openwith-open-windows (file)
+  "Run external command COMMAND, in such a way that it is
+  disowned from the parent Emacs process.  If Emacs dies, the
+  process spawned here lives on.  ARGLIST is a list of strings,
+  each an argument to COMMAND."
+  (w32-shell-execute "open" file))
 
 (defun openwith-file-handler (operation &rest args)
   "Open file with external program, if an association is configured."
             (when (or (not openwith-confirm-invocation)
                       (y-or-n-p (format "%s %s? " (cadr oa)
                                         (mapconcat #'identity params " "))))
-              (openwith-open (cadr oa) params)
+	      (if (eq system-type 'windows-nt)
+		  (openwith-open-windows file)
+		(openwith-open-unix (cadr oa) params))
               (kill-buffer nil)
               (when (featurep 'recentf)
                 (recentf-add-file file))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.