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

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

Re: restricting query-replace to region in emacs lisp script


From: Stefan Monnier
Subject: Re: restricting query-replace to region in emacs lisp script
Date: Wed, 24 Jan 2007 11:11:11 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux)

> I am writing a lisp routine to implement a sequence of query-replace
> operations on a region. Before I run the query-replace I define a
> region, e.g. by mark-paragraph. However, other than in normal
> interactive operation in transient-mark-mode, the query-replace does
> not restrict the query-replace to the marked region. Does anybody know
> how to restrict the region for query-replacing with a lisp-routine?

Better not use query-replace.  The docstring of `perform-replace' shows the
code to use instead.  This code uses re-search-forward which can take
a `limit' argument to tell it where to stop.


        Stefan


reply via email to

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