all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to replace string for a block?
@ 2009-05-26 20:22 Wu, Kejia
  2009-05-26 20:38 ` Lennart Borgman
  2009-05-26 21:56 ` Wu, Kejia
  0 siblings, 2 replies; 13+ messages in thread
From: Wu, Kejia @ 2009-05-26 20:22 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

Is there a way to perform 'M-x replace-string' only for a block?

Thanks!






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

* Re: How to replace string for a block?
  2009-05-26 20:22 How to replace string for a block? Wu, Kejia
@ 2009-05-26 20:38 ` Lennart Borgman
  2009-05-26 20:44   ` Drew Adams
       [not found]   ` <mailman.7863.1243370655.31690.help-gnu-emacs@gnu.org>
  2009-05-26 21:56 ` Wu, Kejia
  1 sibling, 2 replies; 13+ messages in thread
From: Lennart Borgman @ 2009-05-26 20:38 UTC (permalink / raw)
  To: w.kejia; +Cc: help-gnu-emacs

On Tue, May 26, 2009 at 10:22 PM, Wu, Kejia <w.kejia@gmail.com> wrote:
> Hi all,
>
> Is there a way to perform 'M-x replace-string' only for a block?
>
> Thanks!

Hi Kejia,

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.




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

* RE: How to replace string for a block?
  2009-05-26 20:38 ` Lennart Borgman
@ 2009-05-26 20:44   ` Drew Adams
       [not found]   ` <mailman.7863.1243370655.31690.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 13+ messages in thread
From: Drew Adams @ 2009-05-26 20:44 UTC (permalink / raw)
  To: 'Lennart Borgman', w.kejia; +Cc: help-gnu-emacs

> > 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'.





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

* Re: How to replace string for a block?
  2009-05-26 20:22 How to replace string for a block? Wu, Kejia
  2009-05-26 20:38 ` Lennart Borgman
@ 2009-05-26 21:56 ` Wu, Kejia
  1 sibling, 0 replies; 13+ messages in thread
From: Wu, Kejia @ 2009-05-26 21:56 UTC (permalink / raw)
  To: help-gnu-emacs

Hi guys,

Thanks a lot. I prefer 'C-x n n'.

Thank you again.

On Tue, 2009-05-26 at 13:22 -0700, Wu, Kejia wrote:
> Hi all,
> 
> Is there a way to perform 'M-x replace-string' only for a block?
> 
> Thanks!
> 





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

* Re: How to replace string for a block?
       [not found]   ` <mailman.7863.1243370655.31690.help-gnu-emacs@gnu.org>
@ 2009-05-27  8:56     ` Pascal J. Bourguignon
  2009-05-27 12:36       ` Alan Mackenzie
                         ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Pascal J. Bourguignon @ 2009-05-27  8:56 UTC (permalink / raw)
  To: help-gnu-emacs

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

-- 
__Pascal Bourguignon__


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

* Re: How to replace string for a block?
  2009-05-27  8:56     ` Pascal J. Bourguignon
@ 2009-05-27 12:36       ` Alan Mackenzie
       [not found]       ` <mailman.7904.1243427777.31690.help-gnu-emacs@gnu.org>
  2009-05-27 13:35       ` How to replace string for a block? Drew Adams
  2 siblings, 0 replies; 13+ messages in thread
From: Alan Mackenzie @ 2009-05-27 12:36 UTC (permalink / raw)
  To: Pascal J. Bourguignon; +Cc: help-gnu-emacs

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.  ;-)

> __Pascal Bourguignon__

-- 
Alan Mackenzie (Nuremberg, Germany).




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

* Re: How to replace string for a block?
       [not found]       ` <mailman.7904.1243427777.31690.help-gnu-emacs@gnu.org>
@ 2009-05-27 12:51         ` Barry Margolin
  2009-05-27 15:44           ` Alan Mackenzie
                             ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Barry Margolin @ 2009-05-27 12:51 UTC (permalink / raw)
  To: help-gnu-emacs

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


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

* RE: How to replace string for a block?
  2009-05-27  8:56     ` Pascal J. Bourguignon
  2009-05-27 12:36       ` Alan Mackenzie
       [not found]       ` <mailman.7904.1243427777.31690.help-gnu-emacs@gnu.org>
@ 2009-05-27 13:35       ` Drew Adams
  2 siblings, 0 replies; 13+ messages in thread
From: Drew Adams @ 2009-05-27 13:35 UTC (permalink / raw)
  To: 'Pascal J. Bourguignon', help-gnu-emacs

> >> > 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).






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

* Re: How to replace string for a block?
  2009-05-27 12:51         ` Barry Margolin
@ 2009-05-27 15:44           ` Alan Mackenzie
  2009-05-27 17:37             ` Andreas Röhler
  2009-05-27 17:26           ` Vagn Johansen
       [not found]           ` <mailman.7922.1243439002.31690.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 13+ messages in thread
From: Alan Mackenzie @ 2009-05-27 15:44 UTC (permalink / raw)
  To: Barry Margolin; +Cc: help-gnu-emacs

Hi, Barry!

On Wed, May 27, 2009 at 08:51:12AM -0400, Barry Margolin wrote:
> In article <mailman.7904.1243427777.31690.help-gnu-emacs@gnu.org>,
>  Alan Mackenzie <acm@muc.de> wrote:

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

I could probably cope with transient-mark-mode if had been systematically
thought out and its entities called unconfusing things.  The mark ISN'T
transient - once created, it exists until the buffer is killed.  The mark
and the region are never active - they aren't the sort of things that
ever actively DO anything, they never become agents.  "Receptive" would
have been a better word than "active", even if not very good.  This
confusion has given rise to bewildering names like
`mark-even-if-inactive', which is short for "mark is active even if it's
inactive".

The whole topic is such a cesspit of confusion and sloppy thinking, that
I decline to sully myself by even touching it.  t-m-m conflates three
logically unrelated things: (i) highlighting the region; (ii) "narrowing"
the effect of certain commands to the region; (iii) enabling/disabling
certain commands which work on the region (like C-w).  I can see the
benefit of (i) (though I dislike it strongly), and I suppose (ii) might
be handy, though given that C-x n n is so simple, I'm not exacly sure
what for.  As for (iii) - well, I don't need some fascist telling me when
I can delete my region, thank you very much!  That's actually what
`mark-even-if-inactive' means - it would be more accurately called
`region-commands-never-disabled'.  As to why (i) and (ii) aren't
available separately, I suppose lack of clear thinking in the hacker who
created it is the most plausible explanation.

The classical mark was so elegantly simple (it can be described in a
single concise sentence), yet also subtle and economical, the newbie
could grasp it in a few minutes of concentrated thinking.  Which of us
didn't get a "Eureka moment" on seeing how all the various uses of the
mark complemented eachother and jelled so well together?  All that is now
lost.  The imposition of transient mark mode on the newbie burdens him
with a random ragbag of complexity, and I have no good answer to the
anticipated newbie question "what do I have to go through all this stuff
for?".

Still, you like it.  :-)  Would you fancy fixing the documentation for
all this?  The Emacs manual page "The Mark and the Region" decends into
the "if you don't know what I mean by 'widget' you must be an idiot"
style of documentation.  It doesn't have a @dfn{active}.  (I can think of
a good reason. ;-)  It's also unsettling that it says that the text in a
region vanishes when you do something ("The region persists only until
you use it.", where @dfn{region} is THE TEXT between point and mark).
There are probably more confusing things in it.

> Barry Margolin, barmar@alum.mit.edu

-- 
Alan Mackenzie (Nuremberg, Germany).




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

* Re: How to replace string for a block?
  2009-05-27 12:51         ` Barry Margolin
  2009-05-27 15:44           ` Alan Mackenzie
@ 2009-05-27 17:26           ` Vagn Johansen
  2009-05-28  1:03             ` Barry Margolin
       [not found]           ` <mailman.7922.1243439002.31690.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 13+ messages in thread
From: Vagn Johansen @ 2009-05-27 17:26 UTC (permalink / raw)
  To: help-gnu-emacs

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.

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


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)


-- 
Vagn Johansen


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

* Re: How to replace string for a block?
  2009-05-27 15:44           ` Alan Mackenzie
@ 2009-05-27 17:37             ` Andreas Röhler
  0 siblings, 0 replies; 13+ messages in thread
From: Andreas Röhler @ 2009-05-27 17:37 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: help-gnu-emacs

Alan Mackenzie wrote:
> Hi, Barry!
>
> On Wed, May 27, 2009 at 08:51:12AM -0400, Barry Margolin wrote:
>   
>> In article <mailman.7904.1243427777.31690.help-gnu-emacs@gnu.org>,
>>  Alan Mackenzie <acm@muc.de> wrote:
>>     
>
>   
>>> 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.
>>     
>
> I could probably cope with transient-mark-mode if had been systematically
> thought out and its entities called unconfusing things.  The mark ISN'T
> transient - once created, it exists until the buffer is killed.  The mark
> and the region are never active - they aren't the sort of things that
> ever actively DO anything, they never become agents.  "Receptive" would
> have been a better word than "active", even if not very good.  This
> confusion has given rise to bewildering names like
> `mark-even-if-inactive', which is short for "mark is active even if it's
> inactive".
>
> The whole topic is such a cesspit of confusion and sloppy thinking, that
> I decline to sully myself by even touching it.  

Thank you speaking out it so clearly.
Nonetheless its at the very center of editing. Maybe some skillful
relaxed people
will strengthen emacs' editors heart again?

> t-m-m conflates three
> logically unrelated things: (i) highlighting the region; (ii) "narrowing"
> the effect of certain commands to the region; (iii) enabling/disabling
> certain commands which work on the region (like C-w).  I can see the
> benefit of (i) (though I dislike it strongly), and I suppose (ii) might
> be handy, though given that C-x n n is so simple, I'm not exacly sure
> what for.  As for (iii) - well, I don't need some fascist telling me when
> I can delete my region, thank you very much!  That's actually what
> `mark-even-if-inactive' means - it would be more accurately called
> `region-commands-never-disabled'.  As to why (i) and (ii) aren't
> available separately, I suppose lack of clear thinking in the hacker who
> created it is the most plausible explanation.
>
> The classical mark was so elegantly simple (it can be described in a
> single concise sentence), yet also subtle and economical, the newbie
> could grasp it in a few minutes of concentrated thinking.  Which of us
> didn't get a "Eureka moment" on seeing how all the various uses of the
> mark complemented eachother and jelled so well together?  All that is now
> lost.  The imposition of transient mark mode on the newbie burdens him
> with a random ragbag of complexity, and I have no good answer to the
> anticipated newbie question "what do I have to go through all this stuff
> for?".
>
> Still, you like it.  :-)  Would you fancy fixing the documentation for
> all this?  The Emacs manual page "The Mark and the Region" decends into
> the "if you don't know what I mean by 'widget' you must be an idiot"
> style of documentation.  It doesn't have a @dfn{active}.  (I can think of
> a good reason. ;-)  It's also unsettling that it says that the text in a
> region vanishes when you do something ("The region persists only until
> you use it.", where @dfn{region} is THE TEXT between point and mark).
> There are probably more confusing things in it.
>
>   
>> Barry Margolin, barmar@alum.mit.edu
>>     
>
>   





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

* Transient mark mode (was Re: How to replace string for a block?)
       [not found]           ` <mailman.7922.1243439002.31690.help-gnu-emacs@gnu.org>
@ 2009-05-28  0:55             ` Barry Margolin
  0 siblings, 0 replies; 13+ messages in thread
From: Barry Margolin @ 2009-05-28  0:55 UTC (permalink / raw)
  To: help-gnu-emacs

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

> Hi, Barry!
> 
> On Wed, May 27, 2009 at 08:51:12AM -0400, Barry Margolin wrote:
> > In article <mailman.7904.1243427777.31690.help-gnu-emacs@gnu.org>,
> >  Alan Mackenzie <acm@muc.de> wrote:
> 
> > > 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.
> 
> I could probably cope with transient-mark-mode if had been systematically
> thought out and its entities called unconfusing things.  The mark ISN'T
> transient - once created, it exists until the buffer is killed.  The mark
> and the region are never active - they aren't the sort of things that
> ever actively DO anything, they never become agents.  "Receptive" would
> have been a better word than "active", even if not very good.  This
> confusion has given rise to bewildering names like
> `mark-even-if-inactive', which is short for "mark is active even if it's
> inactive".

I think that the closest, simple phrase would be that the region is 
active, enabled, or visible.  But you're correct that it's wrong to 
apply the modifier to the mark.

Emacs has long had a problem with its terminology; I think its use of 
the word "point" has its heritage in TECO (and other CLI text editors), 
which used "." to refer to the current location.  It was written by and 
for computer geeks, who could pick up jargon like this easily.

> 
> The whole topic is such a cesspit of confusion and sloppy thinking, that
> I decline to sully myself by even touching it.  t-m-m conflates three
> logically unrelated things: (i) highlighting the region; (ii) "narrowing"
> the effect of certain commands to the region; (iii) enabling/disabling
> certain commands which work on the region (like C-w).  I can see the
> benefit of (i) (though I dislike it strongly), and I suppose (ii) might
> be handy, though given that C-x n n is so simple, I'm not exacly sure

Yes, C-x n n is imple, I used it for many years.  But I'm a sucker for 
DWIM features.  It's handy not having to narrow, M-x replace-string, 
widen.  And with shell-command.el loaded, I don't have to C-x h when I 
want to pipe the entire buffer to a shell command, which I think is more 
common than just piping a smaller region.

> what for.  As for (iii) - well, I don't need some fascist telling me when
> I can delete my region, thank you very much!  That's actually what
> `mark-even-if-inactive' means - it would be more accurately called
> `region-commands-never-disabled'.  As to why (i) and (ii) aren't
> available separately, I suppose lack of clear thinking in the hacker who
> created it is the most plausible explanation.

I think all of these problems are due to the fact that it was tacked 
onto an editor that had decades of use without this style of editing.  
When Emacs was extended to support GUIs, it seemed natural to try to 
incorporate many of the editing styles that were common there, such as 
marking text with the mouse and highlighting the region as you go.  In 
GUI editors, the Cut and Copy commands are disabled unless you've 
explicitly marked some text, and this was designed to emulate that style.

I think they were trying to keep things relatively simple, by not 
introducing lots of separate concepts for (i), (ii), and (iii).  I admit 
that I occasionally find it frustrating when I type a command and it 
beeps at me, because the region wasn't activated, but I don't think this 
happens very often (not enough to annoy me).  The simplicity of 
conflating all these concepts does indeed result in less flexibility.

> The classical mark was so elegantly simple (it can be described in a
> single concise sentence), yet also subtle and economical, the newbie
> could grasp it in a few minutes of concentrated thinking.  Which of us
> didn't get a "Eureka moment" on seeing how all the various uses of the
> mark complemented eachother and jelled so well together?  All that is now
> lost.  The imposition of transient mark mode on the newbie burdens him
> with a random ragbag of complexity, and I have no good answer to the
> anticipated newbie question "what do I have to go through all this stuff
> for?".

The main problem that the classical mark has for the newbie is that they 
can't tell where it is!  On the other hand, that's not usually a 
problem, since you rarely perform commands that operate on the region 
unless you've just set the mark a moment ago.  But visual clues are 
important for many non-expert users.


> Still, you like it.  :-)  Would you fancy fixing the documentation for
> all this?  The Emacs manual page "The Mark and the Region" decends into
> the "if you don't know what I mean by 'widget' you must be an idiot"
> style of documentation.  It doesn't have a @dfn{active}.  (I can think of
> a good reason. ;-)  It's also unsettling that it says that the text in a
> region vanishes when you do something ("The region persists only until
> you use it.", where @dfn{region} is THE TEXT between point and mark).
> There are probably more confusing things in it.

I don't think I have the time or energy for that much work on 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 ***


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

* Re: How to replace string for a block?
  2009-05-27 17:26           ` Vagn Johansen
@ 2009-05-28  1:03             ` Barry Margolin
  0 siblings, 0 replies; 13+ messages in thread
From: Barry Margolin @ 2009-05-28  1:03 UTC (permalink / raw)
  To: help-gnu-emacs

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


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

end of thread, other threads:[~2009-05-28  1:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-26 20:22 How to replace string for a block? Wu, Kejia
2009-05-26 20:38 ` Lennart Borgman
2009-05-26 20:44   ` Drew Adams
     [not found]   ` <mailman.7863.1243370655.31690.help-gnu-emacs@gnu.org>
2009-05-27  8:56     ` Pascal J. Bourguignon
2009-05-27 12:36       ` Alan Mackenzie
     [not found]       ` <mailman.7904.1243427777.31690.help-gnu-emacs@gnu.org>
2009-05-27 12:51         ` Barry Margolin
2009-05-27 15:44           ` Alan Mackenzie
2009-05-27 17:37             ` Andreas Röhler
2009-05-27 17:26           ` Vagn Johansen
2009-05-28  1:03             ` Barry Margolin
     [not found]           ` <mailman.7922.1243439002.31690.help-gnu-emacs@gnu.org>
2009-05-28  0:55             ` Transient mark mode (was Re: How to replace string for a block?) Barry Margolin
2009-05-27 13:35       ` How to replace string for a block? Drew Adams
2009-05-26 21:56 ` Wu, Kejia

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.