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 21:03:53 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <m2zlcybgo5.fsf@hotmail.com>,
 Vagn Johansen <gonz808@hotmail.com> wrote:

> Barry Margolin <barmar@alum.mit.edu> writes:
> 
> > In article <mailman.7904.1243427777.31690.help-gnu-emacs@gnu.org>,
> >  Alan Mackenzie <acm@muc.de> wrote:
> >
> >> > 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. 
> 
> Why? What did you gain?
> 
> I immediately disabled it when was introduced. Mostly due to a
> (possibly unfounded) fear of having to press C-g all the time to
> disable the mark.

It mostly goes away by itself.

> 
> > 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.
> 
> shell-command-on-region is a part Emacs (simple.el). The
> shell-command.el I know of augments this with completion features.

I installed shell-command.el to get the completion features.  But it 
also adds the feature that shell-command-on-region automatically 
operates on the buffer if the region is not active, so you don't have to 
do C-x h first.

> But anyway, you don't even need transient-mark-mode enabled to do
> this.
> 
> Calling set-mark twice (C-SPC C-SPC) enables transient-mark
> temporarily (~ transient-transient-mark-mode :-) ). I use it all the
> time with M-; (comment-dwim)

I just learned about this and C-u C-x C-x recently.  But the thing I 
like about having transient-mark-mode enabled globally is NOT having to 
type something extra when I want to operate on the region.  The act of 
setting the mark and then moving point usually activates the region, so 
all I then have to do is execute the command that uses it.

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