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: Cygwin patches Date: Mon, 23 Nov 2009 14:50:12 -0500 Message-ID: <4B0AE774.90107@cornell.edu> References: <4B06F562.8060504@cornell.edu> <4B071784.5030901@cornell.edu> <83my2gpa83.fsf@gnu.org> <4B07D914.8070608@cornell.edu> <836394oxr9.fsf@gnu.org> <4B0859F2.8080202@cornell.edu> <39880.128.165.0.81.1258867518.squirrel@webmail.lanl.gov> <4B0935CC.5010704@cornell.edu> <874oomcgcz.fsf@stupidchicken.com> <4B09C807.8000202@cornell.edu> <4B09E73E.8000800@cornell.edu> <876392m2l6.fsf@stupidchicken.com> <4B09EEF7.1020106@cornell.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070105070507000701060904" X-Trace: ger.gmane.org 1259005948 30484 80.91.229.12 (23 Nov 2009 19:52:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Nov 2009 19:52:28 +0000 (UTC) Cc: Eli Zaretskii , Lennart Borgman , emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 23 20:52:21 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 1NCexP-0004Bu-UX for ged-emacs-devel@m.gmane.org; Mon, 23 Nov 2009 20:52:21 +0100 Original-Received: from localhost ([127.0.0.1]:60492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCexP-0005vm-57 for ged-emacs-devel@m.gmane.org; Mon, 23 Nov 2009 14:52:19 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCevX-00054C-IH for emacs-devel@gnu.org; Mon, 23 Nov 2009 14:50:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCevS-000527-Oq for emacs-devel@gnu.org; Mon, 23 Nov 2009 14:50:22 -0500 Original-Received: from [199.232.76.173] (port=40597 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCevS-000524-EX for emacs-devel@gnu.org; Mon, 23 Nov 2009 14:50:18 -0500 Original-Received: from granite1.mail.cornell.edu ([128.253.83.141]:59947 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 1NCevP-0007k4-7K; Mon, 23 Nov 2009 14:50:15 -0500 Original-Received: from [128.84.234.191] (markov.math.cornell.edu [128.84.234.191]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.13.1/8.12.10) with ESMTP id nANJoCVf028709 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 23 Nov 2009 14:50:13 -0500 (EST) User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) In-Reply-To: <4B09EEF7.1020106@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:117614 Archived-At: This is a multi-part message in MIME format. --------------070105070507000701060904 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 11/22/2009 9:09 PM, Ken Brown wrote: > On 11/22/2009 8:50 PM, Chong Yidong wrote: >> Ken Brown writes: >> >>> So are you saying that "file:" (with no slashes) is added by design? >>> It doesn't work for me. (After the call to cygpath, I have a path of >>> the form C:/blah/blah/blah.html; I need to add "file://", since >>> otherwise only "file:" gets added and I don't have a valid URL.) >> >> Does this change (instead of the other patches we've been considering) >> do the right thing on Cygwin? > > No. It still just adds "file:" to the windows path I get after the call > to cygpath. And I can't omit the call to cygpath; if I do that, I'll > have a URL with the right number of slashes, but it won't be one that > the Windows browser will understand. On the other hand, if we adopt part of the patch that Lennart proposed in http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-11/msg00343.html then it does work on cygwin. And, I gather from Lennart's post, this also solves a problem on Windows. The combined patch is attached. [I've also taken the opportunity to make a slight improvement in browse-url-default-windows-browser by using call-process instead of shell-command.] Does this look OK? Ken --------------070105070507000701060904 Content-Type: text/plain; name="browse-url.el.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="browse-url.el.patch" --- browse-url.el.orig 2009-11-20 16:49:49.000000000 -0500 +++ browse-url.el 2009-11-23 14:33:01.843750000 -0500 @@ -444,7 +444,7 @@ ;; applies. ("^/\\([^:@]+@\\)?\\([^:]+\\):/*" . "ftp://\\1\\2/") ,@(if (memq system-type '(windows-nt ms-dos cygwin)) - '(("^\\([a-zA-Z]:\\)[\\/]" . "file:\\1/") + '(("^\\([a-zA-Z]:\\)[\\/]" . "file:///\\1/") ("^[\\/][\\/]+" . "file://"))) ("^/+" . "file:///")) "An alist of (REGEXP . STRING) pairs used by `browse-url-of-file'. @@ -699,6 +699,10 @@ (defun browse-url-file-url (file) "Return the URL corresponding to FILE. Use variable `browse-url-filename-alist' to map filenames to URLs." + (if (eq system-type 'cygwin) + (let ((winfile (with-output-to-string + (call-process "cygpath" nil standard-output nil "-m" file)))) + (setq file (substring winfile 0 -1)))) (let ((coding (and (default-value 'enable-multibyte-characters) (or file-name-coding-system default-file-name-coding-system)))) @@ -835,7 +839,7 @@ (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)))) + (call-process "cygstart" nil nil nil url)) (t (w32-shell-execute "open" url)))) (defun browse-url-default-macosx-browser (url &optional new-window) --------------070105070507000701060904--