unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: Jason Rumney <jasonr@gnu.org>
Cc: Emacs <emacs-devel@gnu.org>
Subject: Re: browse-url/w32-shell-execute problems on cygwin
Date: Wed, 17 Jun 2009 17:30:09 -0400	[thread overview]
Message-ID: <4A396061.4000604@cornell.edu> (raw)
In-Reply-To: <4A392F9A.1030309@cornell.edu>

[-- Attachment #1: Type: text/plain, Size: 812 bytes --]

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

[-- Attachment #2: browse-url.patch --]
[-- Type: text/plain, Size: 1364 bytes --]

--- 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	other threads:[~2009-06-17 21:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17 15:47 browse-url/w32-shell-execute problems on cygwin Ken Brown
2009-06-17 16:06 ` Jason Rumney
2009-06-17 16:14   ` Ken Brown
2009-06-17 18:02   ` Ken Brown
2009-06-17 21:30     ` Ken Brown [this message]
2009-06-17 21:44       ` Chong Yidong
2009-06-18  1:29         ` Ken Brown
2009-06-17 22:23   ` David Robinow
2009-06-18 12:46     ` Ken Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A396061.4000604@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=emacs-devel@gnu.org \
    --cc=jasonr@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).