|
From: | Lennart Borgman |
Subject: | Re: emacsclient: support `/' directory separator on w32 |
Date: | Wed, 29 Nov 2006 17:08:34 +0100 |
User-agent: | Thunderbird 1.5.0.8 (Windows/20061025) |
David Kastrup wrote:
Lennart Borgman <address@hidden> writes:Eli Zaretskii wrote:Date: Wed, 29 Nov 2006 01:51:51 +0100 From: Lennart Borgman <address@hidden> Cc: address@hidden 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?
[Prev in Thread] | Current Thread | [Next in Thread] |