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

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

Re: Advanced query-replace-regexp in code


From: Barry Margolin
Subject: Re: Advanced query-replace-regexp in code
Date: Thu, 28 May 2009 22:14:02 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <address@hidden>,
 address@hidden (Johan Bockgard) wrote:

> Barry Margolin <address@hidden> writes:
> 
> > In that case, why allow programs to call replace-regexp in the first
> > place? If they can call it, why shouldn't they be able to use all the
> > features?
> 
> They shouldn't call it:
> 
>     This function is usually the wrong thing to use in a Lisp program.
>     What you probably want is a loop like this:
>       (while (re-search-forward REGEXP nil t)
>         (replace-match TO-STRING nil nil))
>     which will run faster and will not set the mark or print anything.

Regardless of whether they should or shouldn't use it, it still seems 
strange that the function interprets the second argument differently 
depending on whether it's use interactively or programmatically.  If it 
shouldn't be used programmatically, why is it important that this mode 
*not* recognize \,<expr>?

-- 
Barry Margolin, address@hidden
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

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