From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Friedrich Dominicus Newsgroups: gmane.emacs.help Subject: Re: elisp substitution Date: 18 Jan 2003 18:35:32 +0100 Organization: Q Software Solutions GmbH Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87el7al5sr.fsf@fbigm.here> References: <3E28F08B.6050806@XXnetscape.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1042911357 22070 80.91.224.249 (18 Jan 2003 17:35:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 18 Jan 2003 17:35:57 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18Zwsu-0005jp-00 for ; Sat, 18 Jan 2003 18:35:56 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18Zwt1-0002Em-00 for gnu-help-gnu-emacs@m.gmane.org; Sat, 18 Jan 2003 12:36:03 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn14feed!worldnet.att.net!4.24.21.153!chcgil2-snh1.gtei.net!nycmny1-snf1.gtei.net!news.gtei.net!colt.net!peernews3.colt.net!newsfeed.stueberl.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 23 Original-X-Trace: news.t-online.com 1042911075 07 6083 -pEYEbfSSeYzbL 030118 17:31:15 Original-X-Complaints-To: abuse@t-online.com X-Sender: 320004655587-0001@t-dialin.net User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Native Windows TTY Support) Original-Xref: shelby.stanford.edu gnu.emacs.help:109128 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5655 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5655 matt 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