[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: How to replace string for a block?
From: |
Drew Adams |
Subject: |
RE: How to replace string for a block? |
Date: |
Wed, 27 May 2009 06:35:05 -0700 |
> >> > Is there a way to perform 'M-x replace-string' only for a block?
> >>
> >> Emacs documentation is your friend. Try to read the
> >> documentation by doing C-h f replace-string
> >> It is possible to do what you want, at least in Emacs 23
> >> pretest version.
> >
> > It's possible in any Emacs version. Just narrow the buffer
> > to the block first:
> > `C-x n n'. Widen it again after replacing: `C-x n w'.
>
> There's no need to narrow the buffer: just set the mark and the point
> and M-x replace-{string,regexp} won't go beyond, as documented. Well,
> you've activated transient-mark-mode, of course. Who would disable it?
That only works with transient-mark-mode on (as you mention) and with the region
active, and it works then only for Emacs 21 and later.
Summary:
* Narrowing to the region works in all Emacs versions, with or without
transient-mark-mode on.
* If transient-mark-mode is on and the region is active, then you need not
narrow the buffer (in Emacs 21 or later).
- How to replace string for a block?, Wu, Kejia, 2009/05/26
- Re: How to replace string for a block?, Lennart Borgman, 2009/05/26
- RE: How to replace string for a block?, Drew Adams, 2009/05/26
- Message not available
- Re: How to replace string for a block?, Pascal J. Bourguignon, 2009/05/27
- Re: How to replace string for a block?, Alan Mackenzie, 2009/05/27
- RE: How to replace string for a block?,
Drew Adams <=
- Message not available
- Re: How to replace string for a block?, Barry Margolin, 2009/05/27
- Re: How to replace string for a block?, Alan Mackenzie, 2009/05/27
- Re: How to replace string for a block?, Andreas Röhler, 2009/05/27
- Re: How to replace string for a block?, Vagn Johansen, 2009/05/27
- Re: How to replace string for a block?, Barry Margolin, 2009/05/27
- Message not available
- Transient mark mode (was Re: How to replace string for a block?), Barry Margolin, 2009/05/27
Re: How to replace string for a block?, Wu, Kejia, 2009/05/26