"David A. Cobb" <Superbiskit(a)cox.net> writes:
No, not the same for ~. If the user types / / (or \ \), that is
something that cannot appear legally in a path. She should expect
some special behavior ( or a error ). In fact, she probably knows
what she's doing and expects exactly what happens.
BUT, '~' in a filename is special only at the head of the path. To
get the self-correcting behavior for the tilde, the user should be
typing / / ~ (or some such).
I tend to agree with this reasoning. I'd even go one step farther and
ask whether, with the electric behavior being the default, we even
need to handle appearance of "/~" specially at all.
Not to stray too far afield, similar self-correcting behavior for
the colon (:) in Win NT-Native would be a nice feature -- capture
the preceding character as the drive-letter and toss out anything
before that.
Would someone point me in the direction of the appropriate lisp
routine?
If you wish to implement an "electric colon", take a look at the
implementation of minibuffer-electric-tilde in minibuf.el.
The other place would be substitute-in-file-name, which currently
handles the "/~..." case, but I think it's a better idea to discourage
people from adding more hacks there. If anything, we should have that
function do what the name implies and simply substitute the $ vars; if
other modifications need to be made, those should be done by
read-file-name or by simply relying on the electric tilde/slash/colon
doing their jobs.