[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] emacs lib-src/ChangeLog lib-src/emacsclient.c l...
From: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] emacs lib-src/ChangeLog lib-src/emacsclient.c l... |
Date: |
Tue, 10 Mar 2009 11:58:11 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.90 (gnu/linux) |
>> * emacsclient.c (main): Always pass cwd via "-dir". Pass the file
>> names without prepending cwd to them, so Emacs uses its customary
>> rules to determine how to interpret the file name.
> This change breaks useful Windows behavior.
> Previously:
> C:\> g:
> G:\> cd test
> G:\test> c:
> C:\> emacsclient g:myfile.txt
> opened g:\test\myfile.txt. Now it tries to open g:/myfile.txt.
> The problem is that the "Emacs [...] customary rules to determine how
> to interpret the file name" do not help, because the interpretation of
> g:myfile.txt depends on the shell where you do run emacsclient (you
> can perfectly have two different default directories in g: in
> different shell invocations).
Hmmm.... does the patch below help? If so, please install it,
Stefan
--- emacsclient.c.~1.155.~ 2009-03-10 11:49:18.000000000 -0400
+++ emacsclient.c 2009-03-10 11:56:38.000000000 -0400
@@ -1635,6 +1635,26 @@
continue;
}
}
+#ifdef WINDOWSNT
+ else if (! file_name_absolute_p (argv[i])
+ && (isalpha (argv[i][0]) && argv[i][1] == ':'))
+ /* Windows can have a different default directory for each
+ drive, so the cwd passed via "-dir" is not sufficient
+ to account for that.
+ If the user uses <drive>:<relpath>, we hence need to be
+ careful to expand <relpath> with the default directory
+ corresponding to <drive>. */
+ {
+ char *filename = (char *) xmalloc (MAX_PATH);
+ DWORD size;
+
+ size = GetFullPathName (argv[i], MAX_PATH, filename, NULL);
+ if (size > 0 && size < MAX_PATH)
+ argv[i] = filename;
+ else
+ free (filename);
+ }
+#endif
send_to_emacs (emacs_socket, "-file ");
quote_argument (emacs_socket, argv[i]);