From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.devel Subject: Re: browse-url/w32-shell-execute problems on cygwin Date: Wed, 17 Jun 2009 17:30:09 -0400 Message-ID: <4A396061.4000604@cornell.edu> References: <4A391012.1060306@cornell.edu> <4A3914A3.4090205@gnu.org> <4A392F9A.1030309@cornell.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070003020709060002030103" X-Trace: ger.gmane.org 1245274237 28231 80.91.229.12 (17 Jun 2009 21:30:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jun 2009 21:30:37 +0000 (UTC) Cc: Emacs To: Jason Rumney Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 17 23:30:34 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MH2iF-0007At-68 for ged-emacs-devel@m.gmane.org; Wed, 17 Jun 2009 23:30:31 +0200 Original-Received: from localhost ([127.0.0.1]:57855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MH2iE-00084i-DF for ged-emacs-devel@m.gmane.org; Wed, 17 Jun 2009 17:30:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MH2i9-00084S-OI for emacs-devel@gnu.org; Wed, 17 Jun 2009 17:30:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MH2i4-00083Y-Sa for emacs-devel@gnu.org; Wed, 17 Jun 2009 17:30:25 -0400 Original-Received: from [199.232.76.173] (port=56456 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MH2i4-00083T-Kt for emacs-devel@gnu.org; Wed, 17 Jun 2009 17:30:20 -0400 Original-Received: from granite1.mail.cornell.edu ([128.253.83.141]:48065 helo=authusersmtp.mail.cornell.edu) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MH2i1-0001yl-2t; Wed, 17 Jun 2009 17:30:17 -0400 Original-Received: from [192.168.1.5] (cpe-67-241-20-9.twcny.res.rr.com [67.241.20.9]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.13.1/8.12.10) with ESMTP id n5HLUB9D019909 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 17 Jun 2009 17:30:15 -0400 (EDT) User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) In-Reply-To: <4A392F9A.1030309@cornell.edu> X-detected-operating-system: by monty-python.gnu.org: Solaris 9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:111563 Archived-At: This is a multi-part message in MIME format. --------------070003020709060002030103 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------070003020709060002030103 Content-Type: text/plain; name="browse-url.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="browse-url.patch" --- 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: ")) --------------070003020709060002030103--