[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: substitute-in-file-name and "$"

From: Stefan Monnier
Subject: Re: substitute-in-file-name and "$"
Date: Sun, 06 Jul 2003 13:20:11 -0400

> > > At least the examples in the Elisp manual give the feeling that
> > > substitute-in-file-name could be called without special attention. The
> > > trap with the "$" char isn't obvious.
> > 
> > Consider that the environment-variable's _value_ could contain a `$', so it
> > seems actually fairly obvious that you should only call
> > substitute-in-file-name once...
> Maybe substitute-in-file-name could put a `substitute-in-file-name'
> property on the return value and check for that property on its
> argument (and do nothing if it is present).

This definitely qualifies as over-engineering.
substitute-in-file-name should be used very rarely anyway (in terms of
number of times it shows up in source code), so it's not a big deal.
Most uses of substitute-in-file-name are hidden inside read-file-name.
I'm curious to know which other cases exist.

substitute-in-file-name is basically the function that turns "user-typed"
file names into their "internal" representation, so obviously it should
be applied exactly once.  As for having a filename that's made up of a
user-typed part and an internal part, that's also most likely a bug: the
user-typed part should be passed through substitute-in-file-name before
being combined with the internal part (hopefully with expand-file-name).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]