From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vijay Lakshminarayanan Newsgroups: gmane.emacs.devel Subject: Re: A few Windows build fixes Date: Thu, 01 Sep 2011 23:25:54 +0530 Message-ID: <8739ggf8ph.fsf@gmail.com> References: <83vcth40ik.fsf@kalahari.s2.org> <83r5444ome.fsf@kalahari.s2.org> <87pqjmfgia.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1314899776 691 80.91.229.12 (1 Sep 2011 17:56:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 1 Sep 2011 17:56:16 +0000 (UTC) Cc: Eli Zaretskii , azure@iki.fi, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 01 19:56:12 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QzBUp-0001d1-Gg for ged-emacs-devel@m.gmane.org; Thu, 01 Sep 2011 19:56:11 +0200 Original-Received: from localhost ([::1]:38544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzBUp-0001C1-3D for ged-emacs-devel@m.gmane.org; Thu, 01 Sep 2011 13:56:11 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:48766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzBUl-0001BD-LG for emacs-devel@gnu.org; Thu, 01 Sep 2011 13:56:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QzBUk-0004Th-79 for emacs-devel@gnu.org; Thu, 01 Sep 2011 13:56:07 -0400 Original-Received: from mail-pz0-f44.google.com ([209.85.210.44]:41572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QzBUk-0004TN-1Q; Thu, 01 Sep 2011 13:56:06 -0400 Original-Received: by pzk36 with SMTP id 36so3740394pzk.17 for ; Thu, 01 Sep 2011 10:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=emuKkaAnTZh3KyY7UdceOhRQuocuP5VWU25DPWGaY70=; b=qUHu1pJt+XiYXorFtI8pR4kyyP0+DuKc6X/gwLC+IzUNbknCaU/6VvnK4vJOJ6BWL3 bm6AqZqnSdsYPUdsRI6WN2Zgi0wvOYvW3PGoNBykLR+1cz/npMKqa8z9sLnNDurhmlZX GxXRAMAwMil227nIz4D/n+GRPqmxuTvgpCB8o= Original-Received: by 10.68.2.196 with SMTP id 4mr488752pbw.156.1314899764235; Thu, 01 Sep 2011 10:56:04 -0700 (PDT) Original-Received: from BALROG ([59.92.46.38]) by mx.google.com with ESMTPS id h4sm4648185pbt.10.2011.09.01.10.55.56 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Sep 2011 10:55:59 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Wed, 31 Aug 2011 09:17:46 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (windows-nt) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.44 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:143699 Archived-At: Stefan Monnier writes: >>> > There's a general need for Emacs to understand/accept /cygdrive/foo >>> > names passed on the command-line, so that could be fixed in >>> > lisp/startup.el and lisp/w32*.el. >>> There's cygwin-mount.el available as an elpa package in one of >>> http://tromey.com/elpa or http://marmalade-repo.org/packages/ which >>> works in most cases. > > cygwin-mount.el is a good package, but it has at least the following > problems: > - it affects all file-name operations within Emacs. That's good if you > (the user) want to pretend that Emacs understands cygwin names and > want to be able to type them in, perform completion and stuff. But it > is too intrusive otherwise. > - it can bump into ambiguities ("/home" can mean the "home" subdir in > cygwin's root directory, or it can mean C:/home). This is not > cygwin-mount's fault, but because of how it works, it doesn't try to > solve those ambiguities too carefully. > > So what I proposed above is to use something that also understands > cygwin file names, but only at those places in the code where it's > likely to appear (i.e. for file names that come from outside Emacs), at > which point we can more easily try and resolve ambiguities and we're less > likely to introduce problems. Going through w32-fns.el, I see there's `w32-convert-standard-filename' which actually replaces /cygdrive/ paths correctly. Indeed, (convert-standard-filename "/cygdrive/c/programs/emacs-24.0.50/lisp/w32-fns.el") ; => "c:\\programs\\emacs-24.0.50\\lisp\\w32-fns.el" does the right thing. I briefly went thru `find-file' and it doesn't use `convert-standard-filename' but that's probably the wrong place to change anyway. I made the following change to `server-visit-files' $ diff -u server.el~ server.el --- server.el~ 2011-06-20 12:26:32.000000000 +0530 +++ server.el 2011-09-01 22:31:53.195000000 +0530 @@ -1182,6 +1182,7 @@ (let* ((minibuffer-auto-raise (or server-raise-frame minibuffer-auto-raise)) (filen (car file)) + (filen (convert-standard-filename filen)) (obuf (get-file-buffer filen))) (add-to-history 'file-name-history filen) (if (null obuf) and then tried $ emacsclient -n /cygdrive/c/autoexec.bat but it didn't work because emacsclient provides emacs with the path "c:/cygdrive/c/autoexec.bat". The code should be a little better and check if the file exists (if yes, open immediately) else check if it's a cygwin provided path (have defvars that check if (1) we're on windows and (2) is it a cygwin path...). (Checking if cygwin is in PATH won't work because it's possible that emacs is in cygwin's path but not vice versa.) Is this the right way to go about things? > Stefan -- Cheers ~vijay Gnus should be more complicated.