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: [Emacs-diffs] master 7466a4d: Cygwin emacsclient handles w32 file names Date: Wed, 01 Jul 2015 10:14:20 -0400 Message-ID: <5593F5BC.4030602@cornell.edu> References: <20150630005924.5663.80677@vcs.savannah.gnu.org> <5592018D.7070303@cornell.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1435760101 11134 80.91.229.3 (1 Jul 2015 14:15:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 Jul 2015 14:15:01 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Michael R. Mauger" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 01 16:14:45 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZAImd-0002JZ-TQ for ged-emacs-devel@m.gmane.org; Wed, 01 Jul 2015 16:14:40 +0200 Original-Received: from localhost ([::1]:59095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAImd-0003wG-30 for ged-emacs-devel@m.gmane.org; Wed, 01 Jul 2015 10:14:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAImV-0003pu-Gc for emacs-devel@gnu.org; Wed, 01 Jul 2015 10:14:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAImP-0004j3-KT for emacs-devel@gnu.org; Wed, 01 Jul 2015 10:14:31 -0400 Original-Received: from limerock02.mail.cornell.edu ([128.84.13.242]:45182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAImP-0004be-H8 for emacs-devel@gnu.org; Wed, 01 Jul 2015 10:14:25 -0400 X-CornellRouted: This message has been Routed already. Original-Received: from authusersmtp.mail.cornell.edu (granite3.serverfarm.cornell.edu [10.16.197.8]) by limerock02.mail.cornell.edu (8.14.4/8.14.4_cu) with ESMTP id t61EEGmj005507; Wed, 1 Jul 2015 10:14:16 -0400 Original-Received: from [192.168.1.7] (cpe-67-249-176-138.twcny.res.rr.com [67.249.176.138]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id t61EEEDb031668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 1 Jul 2015 10:14:15 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <5592018D.7070303@cornell.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.84.13.242 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:187697 Archived-At: On 6/29/2015 10:40 PM, Ken Brown wrote: > On 6/29/2015 8:59 PM, Michael Mauger wrote: >> branch: master >> commit 7466a4ded6ded0bea50151395b7a0fccc5dfd167 >> Author: Michael R. Mauger >> Commit: Michael R. Mauger >> >> Cygwin emacsclient handles w32 file names >> --- >> lisp/server.el | 3 +++ >> 1 files changed, 3 insertions(+), 0 deletions(-) >> >> diff --git a/lisp/server.el b/lisp/server.el >> index 2007635..ce19b3c 100644 >> --- a/lisp/server.el >> +++ b/lisp/server.el >> @@ -1167,6 +1167,9 @@ The following commands are accepted by the client: >> (let ((file (pop args-left))) >> (if coding-system >> (setq file (decode-coding-string file >> coding-system))) >> + (when (and (eq system-type 'cygwin) >> + (fboundp >> 'cygwin-convert-file-name-from-windows)) > > There's no need for the 'fboundp ...' here; > cygwin-convert-file-name-from-windows is defined in all Cygwin builds. > >> + (setq file >> (cygwin-convert-file-name-from-windows file))) >> (setq file (expand-file-name file dir)) >> (push (cons file filepos) files) >> (server-log (format "New file: %s %s" > > Are you sure that emacsclient will still handle ordinary Cygwin file > names properly after this change? I'm concerned about file names that > contain characters from the (default) UTF-8 character set. I'm not very > familiar with exactly how cygwin-convert-file-name-from-windows works, > but its name suggests that it should be given a file name that's > understood by Windows. I've tested this a little with file names containing UTF-8-encoded Chinese and other non-ASCII characters, and it appears to work OK. But I *think* it only works because of accidental implementation details of cygwin-convert-file-name-from-windows (and the underlying Cygwin function cygwin_conv_path). Basically, it seems that these functions don't actually try to do any conversion if they are given a multibyte string instead of the expected UTF-16 string. So even though this change *might* be harmless, I think it could lead to bugs later if implementations change. I don't think cygwin-convert-file-name-from-windows should be called on a file name that is not known to be a (UTF-16-encoded) Windows file name. If you look at the (very few) places in the emacs code where that function is currently called, you'll see that the argument is indeed known to be a Windows file name. Ken