From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: Lisp code to expand /~ and // but not env vars?
Date: Mon, 3 Oct 2005 14:07:27 -0700 [thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICMEACCNAA.drew.adams@oracle.com> (raw)
In-Reply-To: <MEEKKIABFKKDFJMPIOEBAEOPCMAA.drew.adams@oracle.com>
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').
Thanks to all who replied. My requirements statement wasn't very good, and I
actually figured out a different way to solve my problem.
FWIW, I meant // or /~ anywhere in an Emacs input file-name, not as the only
input. These are treated specially by substitute-in-file-name, to remove
everything up to and including these, and putting the rest into the root
directory or a home directory, respectively.
Anyway, it turned out that I need to do the regexp matching after this kind
of substitution, but also I want backslash to work for regexps, and not be
interpreted as a directory separator (on Windows). Since I need to
regexp-match after substitute-in-file-name substitution, the solution I
chose was just to fool substitute-in-file-name by replacing any backslashes
with another character (C-g), and then putting them back after
substitute-in-file-name is done.
next prev parent reply other threads:[~2005-10-03 21:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-02 22:51 Lisp code to expand /~ and // but not env vars? 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 message]
[not found] <mailman.9471.1128294372.20277.help-gnu-emacs@gnu.org>
2005-10-03 20:40 ` Thien-Thi Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DNEMKBNJBGPAOPIJOOICMEACCNAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).