How to suppress environment variable expansion by find-file?

Adrian Aichner adrian at xemacs.org
Wed Oct 24 16:36:49 EDT 2007


skip at pobox.com writes:

>     Aidan> Evaluating something like this in *scratch* should work:
>
>     Aidan> (flet ((substitute-in-file-name (filename)
>     Aidan>       filename))
>     Aidan>   (find-file "/home/aidan/$substitute-in-file"))
>
> A bit cumbersome, but I suspect you're correct.
>
> With a little experimentation, I determined there appears to be a behavior
> change between 21.4 and 21.5 in this regard.  If I type these keystrokes in

Right, Skip!

By sheer coincidence I have partially tracked down a variation on the
theme today.

I access files on administrative shares under windows, or should I
say, I used to :-)

Paths of the pattern
\\COMPUTER\DRIVE$\FILE
trigger the same problem.

I can do dired, using
\\COMPUTER\DRIVE$$
which evaluates to
\\COMPUTER\DRIVE$
but opening FILE will evaluate C$ once more and fall over.

The difference is that insert-file-contents in 21.5 epands the file
argument using substitute-in-file-name, which the 21.4 variant did not
use to.

Michael Sperber should know more about this.

Mike?

Adrian

> 21.5.28
>
>     C-x C-f $ $ x RET
>
> I get the "Substituting non-existent environment variable x" error.  If I
> type the same keystrokes in 21.4.21 it will open the file named "$x".  If,
> before hitting RET, I hit TAB, the first time, it removes one of the dollar
> signs.  The second time it emits the error message.  (This is in both 21.4
> and 21.5.)
>
> I'm not well versed enough in XEmacs C source to know what might have
> changed.  It seems from a casual glance that the only changes were
> mechanical (IByte to BufByte, qxstrlen to strlen, etc).  It seems to me that
> there should be some way to override some or all of the function's behavior
> without having to completely redefine it.  (It does both ~ and variable
> expansion, right?)
>
> It's unfortunate that substitute-in-file-name is written in C instead of
> Lisp.  It would be easier to control its behavior with variables if it was
> written in Lisp (or at least mere mortals could more easily control it).
>
> Skip
>
> _______________________________________________
> XEmacs-Beta mailing list
> XEmacs-Beta at xemacs.org
> http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta
>

-- 
Adrian Aichner
 mailto:adrian at xemacs.org
 http://www.xemacs.org/



More information about the XEmacs-Beta mailing list