emacs-devel
[Top][All Lists]
Advanced

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

Re: browse-url/w32-shell-execute problems on cygwin


From: Ken Brown
Subject: Re: browse-url/w32-shell-execute problems on cygwin
Date: Wed, 17 Jun 2009 17:30:09 -0400
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

On 6/17/2009 2:02 PM, Ken Brown wrote:
On 6/17/2009 12:06 PM, Jason Rumney wrote:
Ken Brown wrote:
In browse-url.el, browse-url-browser-function is set to browse-url-default-windows-browser on cygwin.
That is wrong, feel free to change it to a better default.

I don't agree. Since cygwin doesn't provide its own browser, the natural default for a cygwin user is the default windows browser. What I think is wrong (and easy to fix) is that browse-url-default-windows-browser doesn't do the right thing on cygwin.

To focus the discussion more, let me propose the attached patch. The second hunk fixes what I believe to be a bug in browse-url-default-windows-browser. The first hunk is uglier in the way it makes cygwin a special case. Is there a better way to do this?

Ken
--- browse-url.el.orig  2009-01-06 15:29:22.000000000 -0500
+++ browse-url.el       2009-06-17 17:24:02.644422200 -0400
@@ -693,7 +693,9 @@
          (cond ((not (buffer-modified-p)))
                (browse-url-save-file (save-buffer))
                (t (message "%s modified since last save" file))))))
-  (browse-url (browse-url-file-url file))
+  (if (eq system-type 'cygwin)
+      (shell-command (concat "cygstart " (shell-quote-argument file)))
+    (browse-url (browse-url-file-url file)))
   (run-hooks 'browse-url-of-file-hook))
 
 (defun browse-url-file-url (file)
@@ -827,11 +829,13 @@
 
 (defun browse-url-default-windows-browser (url &optional new-window)
   (interactive (browse-url-interactive-arg "URL: "))
-  (if (eq system-type 'ms-dos)
-      (if dos-windows-version
-         (shell-command (concat "start " (shell-quote-argument url)))
-       (error "Browsing URLs is not supported on this system"))
-    (w32-shell-execute "open" url)))
+  (cond ((eq system-type 'ms-dos)
+        (if dos-windows-version
+            (shell-command (concat "start " (shell-quote-argument url)))
+          (error "Browsing URLs is not supported on this system")))
+       ((eq system-type 'cygwin)
+        (shell-command (concat "cygstart " (shell-quote-argument url))))
+       (t (w32-shell-execute "open" url))))
 
 (defun browse-url-default-macosx-browser (url &optional new-window)
   (interactive (browse-url-interactive-arg "URL: "))

reply via email to

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