help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sunrise Commander: Version 3 released.


From: escherdragon
Subject: Re: Sunrise Commander: Version 3 released.
Date: Wed, 18 Mar 2009 09:58:41 -0700 (PDT)
User-agent: G2/1.0

On 18 Mar, 13:26, rustom <rustompm...@gmail.com> wrote:
(...)
> > 0.5) Get and install Markus Triska's openwith -- it will allow to open
> > your files using external programs based on file extension. It can be
> > found in the Emacs Wiki:http://www.emacswiki.org/emacs/OpenWith
>
> > Isn't this solution good enough? I find it fantastic, but to be honest
> > I haven't tried it on Windows.
>
> Does not work on windows.

Oh, that's a real shame. Luckily not hard to fix :) I've just
submitted the following patch for Mr. Triska to consider applying it
to the standard distribution:

*************************** CUT HERE ***************************

--- openwith.el 2009-01-19 10:26:09.000000000 +0100
+++ openwith.el 2009-03-18 15:44:30.000000000 +0100
@@ -75,16 +75,19 @@
         (setq oa (car assocs)
               assocs (cdr assocs))
         (when (save-match-data (string-match (car oa) file))
-          (let ((params (mapcar (lambda (x) (if (eq x 'file) file x))
-                                (nth 2 oa))))
-            (when (or (not openwith-confirm-invocation)
-                      (y-or-n-p (format "%s %s? " (cadr oa)
-                                        (mapconcat #'identity params
" "))))
-              (apply #'start-process "openwith-process" nil (cadr oa)
params)
-              (kill-buffer nil)
-              ;; inhibit further actions
-              (error "Opened %s in external program"
-                     (file-name-nondirectory file))))))))
+         (let ((params (mapcar (lambda (x) (if (eq x 'file) file x))
+                               (nth 2 oa))))
+           (when (or (not openwith-confirm-invocation)
+                     (y-or-n-p (format "%s %s? " (cadr oa)
+                                       (mapconcat #'identity params " "))))
+             (if (and (fboundp 'w32-shell-execute)
+                      (string= "open" (nth 1 oa)))
+                 (w32-shell-execute "open" file)
+               (apply #'start-process "openwith-process" nil (cadr oa) params))
+             (kill-buffer nil)
+             ;; inhibit further actions
+             (error "Opened %s in external program"
+                    (file-name-nondirectory file))))))))
   ;; when no association was found, relay the operation to other
handlers
   (let ((inhibit-file-name-handlers
          (cons 'openwith-file-handler

*************************** CUT HERE ***************************

with this modification, openwith works OK on windows too. You
configure it the same way one does in linux:

     M-x customize-variable RET openwith-associations RET

just instead of using real program names, use the string
"open" (without the quotes) as the program to open all the extensions
of the files you want managed directly by windows.

Hope this helps.

Cheers,
--
José A. Romero L.
escherdragon@gmail.com
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]