emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Search nodes in Emacs manual


From: David Kastrup
Subject: Re: Search nodes in Emacs manual
Date: 19 Jun 2004 20:52:19 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Juri Linkov <address@hidden> writes:

> David Kastrup <address@hidden> writes:
> > Juri Linkov <address@hidden> writes:
> >> But perhaps with the latest changes this example can be replaced
> >> with more advanced like this:
> >> 
> >>     M-x replace-regexp <RET> \(x\|y\) <RET> \,(if (equal \& "x") "y"
> >>     "x") <RET>
> >
> > Cute.  Of course \(x\|y\) is shorter as [xy]
> 
> I intended to make it as an example of exchanging words which might
> be more useful than exchanging characters.  So that example
> could be rewritten as something like below, and be placed into
> (info "(emacs)Regexp Replace") instead of the current
> (info "(emacs)Unconditional Replace"), or to the same node
> where you might document this new feature.
> 
>   M-x replace-regexp <RET> \(ab\|cd\) <RET>
>                            \,(if (equal \& "ab") "cd" "ab") <RET>

You'd better use string=, or font-lock might surprise you.

How about

M-x replace-regexp <RET> \(\(ab\)\|cd\) <RET>
                         \,(if \2 "cd" "ab") <RET>

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

[Prev in Thread] Current Thread [Next in Thread]