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: Johan Bockgård
Subject: Re: Advanced query-replace-regexp in code
Date: Thu, 28 May 2009 21:36:23 +0200
User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/23.0.90 (gnu/linux)

Barry Margolin <barmar@alum.mit.edu> 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.





reply via email to

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