unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Lisp code to expand /~ and // but not env vars?
@ 2005-10-02 22:51 Drew Adams
  2005-10-02 23:16 ` Lennart Borgman
  2005-10-03 21:07 ` Drew Adams
  0 siblings, 2 replies; 8+ messages in thread
From: Drew Adams @ 2005-10-02 22:51 UTC (permalink / raw)


I'm looking for Lisp code that will expand /~ and // in a file name, just as
`substitute-in-file-name' does, but without substituting environment
variables.  I want to rationalize a user-input file name, which might
contain /~ and //, but I only want to expand env vars (recursively) in a
separate, later step (e.g. with `substitute-in-file-name').

Can anyone suggest a way to do this /~ and // conversion in Lisp?

Context: On Windows, `substitute-in-file-name' also changes \ to /, and
that's fine, inside env vars, but I don't want this to be done at the top
user-input level. Instead, I want to treat the user input as a regexp (with
normal regexp interpretation of backslash), and only afterward use
`substitute-in-file-name' to recursively expand the env vars. IOW, I don't
want to change \ to / at the top level; I just want to expand /~ and // at
the top level (and not \~ and \\, even on Windows).

It looks like the only existing code to do the /~ and // conversion is C
code (C function `search_embedded_absfilename') that is embedded as part of
the definition of `substitute-in-file-name'. I'm looking for a way to do
(only) that in Lisp.  Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-10-03 21:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.9471.1128294372.20277.help-gnu-emacs@gnu.org>
2005-10-03 20:40 ` Lisp code to expand /~ and // but not env vars? Thien-Thi Nguyen
2005-10-02 22:51 Drew Adams
2005-10-02 23:16 ` Lennart Borgman
2005-10-03  0:03   ` Drew Adams
2005-10-03 10:50     ` Peter Dyballa
2005-10-03 16:34       ` Lennart Borgman
     [not found]     ` <mailman.9543.1128345398.20277.help-gnu-emacs@gnu.org>
2005-10-03 14:55       ` Mathias Dahl
2005-10-03 21:07 ` Drew Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).