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

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

Re: How to replace string for a block?


From: Barry Margolin
Subject: Re: How to replace string for a block?
Date: Wed, 27 May 2009 08:51:12 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.7904.1243427777.31690.help-gnu-emacs@gnu.org>,
 Alan Mackenzie <acm@muc.de> wrote:

> Hi, Pascal!
> 
> On Wed, May 27, 2009 at 10:56:24AM +0200, Pascal J. Bourguignon wrote:
> > "Drew Adams" <drew.adams@oracle.com> writes:
> 
> > >> > 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?
> 
> I would.  Actually, I have.  transient-mark-mode is an ill thought out
> conflation of several logically unrelated features, some of which have
> names which can only have been thought up when their namers were smoking
> something soothing, complicated to use, and utterly at variance with
> Emacs's ethos of elegant simplicity and keeping out of the user's way.
> 
> Some people seem to like it, though.  ;-)

I've been an Emacs user for almost 30 years.  For at least half that 
time transient-mark-mode didn't even exist, and after it was added (for 
the benefit of converts from PC word processors, I believe) I resisted 
enabling it for a long time, it seemed like sacrilege.  But I finally 
gave in a couple of years ago when I started using Emacs in GUI mode 
heavily at work, and I'm happy I did.  I particularly like when commands 
automatically operate on either the buffer or region depending on 
whether it's enabled.  I installed shell-command.el, which makes 
shell-command-on-region do this automagically.

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