From: Friedrich Dominicus <frido@q-software-solutions.com>
Subject: Re: elisp substitution
Date: 18 Jan 2003 18:35:32 +0100 [thread overview]
Message-ID: <87el7al5sr.fsf@fbigm.here> (raw)
In-Reply-To: 3E28F08B.6050806@XXnetscape.net
matt <nwzmattXX@XXnetscape.net> writes:
> I'm just starting to play around with emacs lisp. A quick
> question. How can I manipulate variables in elisp? For instance, I
> want to take a string and add a backslash(escape) to all
> whitespace. Like in a path like
>
> "c:/Documents and settings/" I want to change it to
> "c:/Documents\ and\ Settings/".
>
> Something similar to this in perl: $var =~ s/( )/\\$1/g;
\ are unfine in Emacs lisp but here we go
(defvar *str* "c:\\Dokumente und Einstellungen\\")
(replace-in-string *str* (regexp-quote "\\") "/" )
"c:/Dokumente und Einstellungen/"
If I would not use regexp-quote I would have to write
"\\\\" the so calles scatterd tootpick syndrome ;-)
If you would just have nearly everything else it would be easier
Regards
Friedrich
next prev parent reply other threads:[~2003-01-18 17:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-18 9:13 elisp substitution matt
2003-01-18 17:35 ` Friedrich Dominicus [this message]
2003-01-18 22:04 ` Christopher J. White
2003-01-18 22:14 ` Jesper Harder
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87el7al5sr.fsf@fbigm.here \
--to=frido@q-software-solutions.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.