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

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

Re: using lisp in replacement string


From: Barry Margolin
Subject: Re: using lisp in replacement string
Date: Wed, 24 Dec 2014 11:43:48 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.16678.1419438348.1147.help-gnu-emacs@gnu.org>,
 Guido Van Hoecke <guivho@gmail.com> wrote:

> Hi,
> 
> "This function is for interactive use only;
> >> in Lisp code use `re-search-forward' and `replace-match' instead."
> >> ...
> >> "In interactive calls, the replacement text may contain `\,'"
> >>
> >
> I still do not get it. Say following content i​n the *scratch* buffer:

This isn't done in replace-match. It's specific to replace-regexp, and 
it checks whether it was invoked interactively rather than from Lisp to 
determine whether to look for that string. It's a total hack.

If you're writing your own Lisp functions, you should use match-string 
to get the matched string or capture group, do whatever you want to 
produce the replacement (e.g. call calc-eval), and then call 
replace-match with this result.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

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