Miles Bader <[EMAIL PROTECTED]> writes:

> On Mon, 21 Mar 2005 08:24:38 -0500, Stefan Monnier
> <[EMAIL PROTECTED]> wrote:
>> How 'bout the patch below which makes no assumption (that I know of) about
>> substitute-in-file-name, and will thus correctly even with weird
>> magic file name handlers.
>
> Um, I should note that the original code was designed to be fast and
> not cons unnecessarily, because it runs on every keystroke -- that's
> the reason it uses just a regexp match and a move-overlay.  Your
> suggested replacement looks ... less careful.

substitute-in-file-name is a built-in function in `C source code'.
(substitute-in-file-name FILENAME &optional PARSEINFO)

Substitute environment variables referred to in FILENAME.
`$FOO' where FOO is an environment variable name means to substitute
the value of that variable.  The variable name should be terminated
with a character not a letter, digit or underscore; otherwise, enclose
the entire variable name in braces.
If `/~' appears, all of FILENAME through that `/' is discarded.

On VMS, `$' substitution is not done; this function does little and only
duplicates what `expand-file-name' does.

If PARSEINFO is not NIL, it is a list used or reused for storing
parsing information (it is extended as necessary).

Elements 2N point to positions in the original string, Elements 2N+1
to corresponding positions in the substituted string.

[...]

Something like that.  And then one looks for the last [x,0] pair in
the list, and x is the position from which to shadow.

No consing done except when the syntax changes on entry.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to