all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Teika Kazura <teika@gmx.com>, 13178@debbugs.gnu.org
Subject: bug#13178: Query-replace fails soon after narrow-to-region
Date: Fri, 27 Feb 2015 07:01:52 -0800 (PST)	[thread overview]
Message-ID: <4c17eddd-79fb-4939-98d2-5f929e5f1c7c@default> (raw)
In-Reply-To: <20150227.171230.1758903055908506043.teika@gmx.com>

> 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	other threads:[~2015-02-27 15:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14  4:03 bug#13178: Query-replace fails soon after narrow-to-region Teika Kazura
2015-02-27  8:12 ` Teika Kazura
2015-02-27 15:01   ` Drew Adams [this message]
2015-02-27 19:50     ` Artur Malabarba
2015-03-02 17:23       ` Stefan Monnier
2015-03-02 20:14         ` Juri Linkov
2015-03-02 21:51           ` Artur Malabarba
2015-03-12 19:53             ` Juri Linkov
2015-11-13 23:39               ` Juri Linkov
2015-03-03 23:31   ` Teika Kazura
2015-03-04  1:16     ` Artur Malabarba
2015-03-05  0:16       ` Teika Kazura

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c17eddd-79fb-4939-98d2-5f929e5f1c7c@default \
    --to=drew.adams@oracle.com \
    --cc=13178@debbugs.gnu.org \
    --cc=teika@gmx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.