* bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths:
@ 2009-10-28 20:19 MON KEY
2009-10-28 21:38 ` Juanma Barranquero
0 siblings, 1 reply; 5+ messages in thread
From: MON KEY @ 2009-10-28 20:19 UTC (permalink / raw)
To: bug-gnu-emacs
w32 paths `substitute-in-file-name' fails when environmental variable
is set for \\ style paths:
;; :SITUATION-1 w/out trailing `\\'
(setenv "HOME2" "C:\\home\\me")
(getenv "HOME2")
;=> "C:\\home\\me"
(substitute-in-file-name "$HOME2\\.emacs")
;=> "C:\\home\\me/emacs"
(substitute-in-file-name "$HOME2/.emacs")
;=>"C:\\home\\me/.emacs"
(substitute-in-file-name "$HOME2.emacs")
;=> "C:\\home\\me.emacs"
;; :SITUATION-2 with trailing `\\'
(setenv "HOME2" "C:\\home\\me\\")
(getenv "HOME2")
;=> "C:\\home\\me\\"
(substitute-in-file-name "$HOME2\\.emacs")
;=> "/.emacs"
(substitute-in-file-name "$HOME2\.emacs")
;=> "C:\\home\\me\\.emacs"
(substitute-in-file-name "$HOME2//.emacs")
;=> "/.emacs"
(substitute-in-file-name "$HOME2.emacs")
;=> "C:\\home\\me\\.emacs"
;; ON FOLLOWING SYSTEM:
GNU Emacs 23.1.50.1 (i386-mingw-nt5.1.2600)
of 2009-06-30 on LENNART-69DE564 (patched)
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths:
2009-10-28 20:19 bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths: MON KEY
@ 2009-10-28 21:38 ` Juanma Barranquero
2009-10-29 0:43 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Juanma Barranquero @ 2009-10-28 21:38 UTC (permalink / raw)
To: MON KEY; +Cc: 4823
On Wed, Oct 28, 2009 at 21:19, MON KEY <monkey@sandpframing.com> wrote:
> ;; :SITUATION-1 w/out trailing `\\'
> (substitute-in-file-name "$HOME2\\.emacs")
> ;=> "C:\\home\\me/emacs"
I get "C:\\home\\me/.emacs", which seems correct.
> (substitute-in-file-name "$HOME2/.emacs")
> ;=>"C:\\home\\me/.emacs"
> (substitute-in-file-name "$HOME2.emacs")
> ;=> "C:\\home\\me.emacs"
These seem correct to me.
> ;; :SITUATION-2 with trailing `\\'
> (substitute-in-file-name "$HOME2\\.emacs")
> ;=> "/.emacs"
$HOME2\\.emacs ==> "C:\\home\\me\\\\.emacs" ==> C:\home\me\\.emacs
According to the docstring of `substitute-in-file-name':
If `//' appears, everything up to and including the first of
those `/' is discarded.
and \\ (quoted to \\\\) is equivalent to // in w32 filenames (at least
for Emacs).
> (substitute-in-file-name "$HOME2\.emacs")
> ;=> "C:\\home\\me\\.emacs"
$HOME2\.emacs ==> "C:\\home\\me\\\.emacs" ==> C:\home\me\.emacs
so this is correct (remember that "\." == ".").
> (substitute-in-file-name "$HOME2//.emacs")
> ;=> "/.emacs"
This is similar to the \\\\ case above:
$HOME2//.emacs ==> "C:\\home\\me\\//.emacs" ==> C:\home\me\//.emacs
which could arguably be //.emacs, but that does not seem very useful.
> (substitute-in-file-name "$HOME2.emacs")
> ;=> "C:\\home\\me\\.emacs"
That seems correct.
What where you expecting in each case?
Juanma
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths:
2009-10-28 21:38 ` Juanma Barranquero
@ 2009-10-29 0:43 ` Stefan Monnier
2011-07-02 1:39 ` Juanma Barranquero
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2009-10-29 0:43 UTC (permalink / raw)
To: Juanma Barranquero; +Cc: 4823, MON KEY
> According to the docstring of `substitute-in-file-name':
> If `//' appears, everything up to and including the first of
> those `/' is discarded.
Admittedly, I think substitute-in-file-name implements this feature
incorrectly, because the double-slash handling should be done before
envvar expansion (envvars ceom from outside Emacs usually, so they
generally rely on the convention that /foo///bar is equivalent to
/foo/bar rather than to /bar).
OTOH if an envvar holds "http://foo/bar", then we'd want to use
url-handler-mode's implementation of substitute-in-file-name, which
would argue for doing expansion early. It's probably tricky to get it
to do the right thing in "all" cases.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths:
2009-10-29 0:43 ` Stefan Monnier
@ 2011-07-02 1:39 ` Juanma Barranquero
2011-07-02 1:47 ` Juanma Barranquero
0 siblings, 1 reply; 5+ messages in thread
From: Juanma Barranquero @ 2011-07-02 1:39 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 4823, MON KEY
I'm closing this one because the original reported behavior is not a
bug, and there's nothing else to do.
Juanma
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths:
2011-07-02 1:39 ` Juanma Barranquero
@ 2011-07-02 1:47 ` Juanma Barranquero
0 siblings, 0 replies; 5+ messages in thread
From: Juanma Barranquero @ 2011-07-02 1:47 UTC (permalink / raw)
To: 4823-done
> I'm closing this one
No, *now* I'm closing it...
Juanma
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-07-02 1:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-28 20:19 bug#4823: w32 paths `substitute-in-file-name' fails when environmental variable is set for \\ style paths: MON KEY
2009-10-28 21:38 ` Juanma Barranquero
2009-10-29 0:43 ` Stefan Monnier
2011-07-02 1:39 ` Juanma Barranquero
2011-07-02 1:47 ` Juanma Barranquero
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.