all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* restricting query-replace to region in emacs lisp script
@ 2007-01-24 13:09 conscious
  2007-01-24 14:37 ` David Hansen
  2007-01-24 16:11 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: conscious @ 2007-01-24 13:09 UTC (permalink / raw)
  To: help-gnu-emacs

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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: restricting query-replace to region in emacs lisp script
  2007-01-24 13:09 restricting query-replace to region in emacs lisp script conscious
@ 2007-01-24 14:37 ` David Hansen
  2007-01-24 16:11 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: David Hansen @ 2007-01-24 14:37 UTC (permalink / raw)
  To: help-gnu-emacs

On 24 Jan 2007 05:09:36 -0800 conscious wrote:

> 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?

`narrow-to-region'

David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: restricting query-replace to region in emacs lisp script
  2007-01-24 13:09 restricting query-replace to region in emacs lisp script conscious
  2007-01-24 14:37 ` David Hansen
@ 2007-01-24 16:11 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2007-01-24 16:11 UTC (permalink / raw)
  To: help-gnu-emacs

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-24 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-24 13:09 restricting query-replace to region in emacs lisp script conscious
2007-01-24 14:37 ` David Hansen
2007-01-24 16:11 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.