help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Then how to replace all my $$ ... $$ to \[ \] through search and rep


From: harven
Subject: Re: Then how to replace all my $$ ... $$ to \[ \] through search and replace?
Date: Sat, 16 Aug 2008 06:49:50 -0700 (PDT)
User-agent: G2/1.0

> David Kastrup once mention this (or a similar example with
> `replace-regexp') on some newsgroup or mailing list.  I don't remember
> if it is possible to use this with M-x replace-... or
> query-replace... as well.

M-:(replace-regexp "\\$\\$" '("\\\[" "\\\]"))
It is in fact a feature of the perform-replace function.
Quoting the elisp manual section dealing with this function:

> The argument REPLACEMENTS specifies what to replace occurrences >  with.  If 
> it is a string, that string is used.  It can also be a
>  list of strings, to be used in cyclic order.

>  If REPLACEMENTS is a cons cell, `(FUNCTION . DATA)', this means to
> call FUNCTION after each match to get the replacement text.  This
> function is called with two arguments: DATA, and the number of
> replacements already made.


reply via email to

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