From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: emacsclient: support `/' directory separator on w32 Date: Wed, 29 Nov 2006 17:08:34 +0100 Message-ID: <456DB082.4090008@student.lu.se> References: <20061124054526.72239.qmail@web62511.mail.re1.yahoo.com> <85fyc3oiio.fsf@lola.goethe.zz> <854psjoh67.fsf@lola.goethe.zz> <85r6vnmz3s.fsf@lola.goethe.zz> <857ixfkyqu.fsf@lola.goethe.zz> <456CC2B4.3000003@student.lu.se> <456CD9A7.5010006@student.lu.se> <456D44EE.2080906@student.lu.se> <85mz6ah8y6.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1164816584 9981 80.91.229.2 (29 Nov 2006 16:09:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 29 Nov 2006 16:09:44 +0000 (UTC) Cc: lekktu@gmail.com, Eli Zaretskii , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 29 17:09:38 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GpRzi-0001t1-BS for ged-emacs-devel@m.gmane.org; Wed, 29 Nov 2006 17:09:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GpRzh-0008Qj-Qs for ged-emacs-devel@m.gmane.org; Wed, 29 Nov 2006 11:09:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GpRzR-0008O8-9R for emacs-devel@gnu.org; Wed, 29 Nov 2006 11:08:53 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GpRzM-0008EY-7z for emacs-devel@gnu.org; Wed, 29 Nov 2006 11:08:53 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GpRzM-0008EI-29 for emacs-devel@gnu.org; Wed, 29 Nov 2006 11:08:48 -0500 Original-Received: from [80.76.149.212] (helo=ch-smtp01.sth.basefarm.net) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GpRzE-0004Gh-6X; Wed, 29 Nov 2006 11:08:40 -0500 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:61535 helo=[192.168.123.121]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1GpRzB-0007Ni-65; Wed, 29 Nov 2006 17:08:38 +0100 User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) Original-To: David Kastrup In-Reply-To: <85mz6ah8y6.fsf@lola.goethe.zz> X-Scan-Result: No virus found in message 1GpRzB-0007Ni-65. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1GpRzB-0007Ni-65 45f3201a562ceac1f7811a2ac5ee0ea0 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:63032 David Kastrup wrote: > Lennart Borgman writes: > >> Eli Zaretskii wrote: >>>> Date: Wed, 29 Nov 2006 01:51:51 +0100 >>>> From: Lennart Borgman >>>> Cc: emacs-devel@gnu.org >>>> >>>> I am not quite sure, but I believe I have seen that the >>>> recommendation from MS for a file argument is to use >>>> GetFullPathName. >>> But Emacs does not do it, see expand-file-name. So your proposed >>> changes make emacsclient behave differently than Emacs. >> >> What is the reason that Emacs does not do it? > > Emacs stores its idea of "relativeness" in `default-directory', a > buffer-local variable. > > It is not clear how one would attempt to model drive-relativeness on > different drives than the one the buffer is in. It is possible to > make `default-directory' point to a different drive from that of > `buffer-file-name'. Maintaining the old drive-relative position at > the same time does not seem possible to do in a reasonably predictable > way. I also thought so at first. At a second thought it seems simple. Just set emacs working directory (on w32) at the same time as setting default-directory. Then GetFullPathName will always return a result that is consistent with default-directory. However the glory details of coding this in emacs is not something I precisely know immediately how to do ;-) And setting the working directory makes me a bit scared too. But is the working directory ever used in emacs? (I found one call to get_current_directory_name in smc_save_yourself.) Some more trouble: You can ask emacs to edit a file with a name like d:/somepath/c:hello.txt. The characters \/:*?"<>| are not allowed in the last part of a file or directory name on w32. (Actually using a file name with ":" in the name is possible, but it does not do what an innocent user expect. It creates a file with a hidden what-did-they-call-it? part.) Unfortunately GetLongPathName() does not care about these characters. I therefore tried with GetLongPathName(), but I could not link with MingGW: oo-spd/i386/emacsclient.o(.text+0x283b):emacsclient.c: undefined reference to `GetLongPathName' Maybe there is a better API for checking file names?