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

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

bug#13178: Query-replace fails soon after narrow-to-region


From: Drew Adams
Subject: bug#13178: Query-replace fails soon after narrow-to-region
Date: Fri, 27 Feb 2015 07:01:52 -0800 (PST)

> Sorry, it's not a bug, but a specification.
> 
> If a region is active, `query-replace' (together with `replace-string') gets
> narrowed inside there.  I didn't know that, and activated a zero-size region
> in the procedure described above.

Just FYI - It might help you recognize this situation if you use library
`mode-line-posn.el'.  It has the following behavior, which addresses the
gotcha you mention:

1. The size of the region is shown in the mode line when the region is active.  
   Option `modelinepos-empty-region-flag' determines whether to also indicate
   an empty active region.  By default it is t, meaning indicate an empty
   active region.

2. Option `modelinepos-style' lets you choose the region info shown when the
   region is active: (a) number of chars, (b) number of chars and lines, or
   (c) anything else you might want.  Choice (b) is the default.

3. The region highlighting in the mode-line is changed to a different face
   when you invoke a command that behaves specially for an active region,
   such as `query-replace'.

The fact that `modelinepos-empty-region-flag' is non-nil by default means
that whenever the region is active but empty you can easily notice this.

#3 means that you can immediately tell when the region is active and you
are currently using a command whose behavior changes when the region is
active.

More info and screenshots here:
http://www.emacswiki.org/emacs/ModeLinePosition

I proposed such behavior for Emacs, but there was no interest in it.
It helps me.  Maybe it will help you too.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]