GNU bug report logs -
#13178
Query-replace fails soon after narrow-to-region
Previous Next
Reported by: Teika Kazura <teika <at> lavabit.com>
Date: Fri, 14 Dec 2012 04:06:02 UTC
Severity: normal
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> 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.
This bug report was last modified 9 years and 248 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.