From: Ergus <spacibba@aol.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>,
emacs-devel@gnu.org, Juri Linkov <juri@linkov.net>
Subject: Re: isearch region or thing at point.
Date: Tue, 30 Apr 2019 18:57:19 +0200 [thread overview]
Message-ID: <20190430165719.yrcvz6oq5ktkyuug@Ergus> (raw)
In-Reply-To: <bbb768fe-2b89-4d9c-9dae-4a3e5ccbea33@default>
On Tue, Apr 30, 2019 at 08:39:56AM -0700, Drew Adams wrote:
>> Thanks, such addition is welcome. Currently searching the
>> active region requires invocation of several commands: M-w C-s M-y
>> with a bad side-effect of leaving the region in the kill-ring.
>>
>> However, adding a new option is not a satisfactory solution
>> because often isearch is used to extend the boundaries of the
>> active region, e.g. by setting the region's beginning with C-SPC,
>> then searching the region's end and exiting isearch there.
>>
>> Fortunately, like Basil mentioned the command isearch-forward-symbol-at-point
>> bound to 'M-s .' you could create a similar command bound to e.g. 'M-s r'
>> that would start isearch with the text from the active region.
>
Hi Drew, very thanks for replying:
>My own take on this:
>
>1. A user option is helpful (only) for users who really
> want this behavior all the time. Unless, that is,
> Emacs decides to let users toggle the option with a
> (search-map) key. Vanilla Emacs doesn't like to do
> that, opting instead for using a non-option variable
> (letting you toggle that).
>
Ok, got it
>2. It's already simple to search for the region text, as
> Juri points out: `M-w C-s M-y'. And as he says, you
> can easily define a command that does that from the
> outset.
>
Of course the user could write anything, but this is a simple basic
functionality available in gedit, geany, vim, qtcreator... but also in
firefox, chromium, and so on... So, there is not any reason why emacs
will provide no "easy" way to enable/access it somehow.
Specially for the detail that we don't disable the region after the
search was canceled. That's a more intuitive behavior.
(Is a problem of simplicity and effort for the user)
>
> FWIW, as one user, I don't have a problem with `M-w'
> adding the region text to the kill-ring. I don't see
> that as a "bad side-effect" but rather as something
> often useful. But sure, you can make searching for
> selected text be independent from adding that text to
> the kill-ring.
>
Touching the kill-ring for a simple search is unnatural, but also the
command is extremely long (and sparse in the keyboard) for something
that any programmed needs every 5 minutes.
> If you set option `mouse-drag-copy-region' to non-nil
> then text selected with the mouse is automatically
> added to the kill-ring, so you can just use `M-y'
> during search to yank it.
>
In my opinion Emacs should be equally functional with and without the
mouse. There are people (like me) that still use emacs only in terminal
mode.
>3. There are several different ways the active region
> can be useful for Isearch. Juri mentioned one:
> extend the region end to a searched position. Each
> way to use the region should be optional, and
> sometimes some of them can be combined. Whatever you
> provide, please make it optional.
>
> By way of example, here are some ways the region can
> be used for Isearch that are offered by library
> Isearch+ as optional behaviors:
>
> a. Search only within the active region: option
> `isearchp-restrict-to-region-flag' - toggle with
> `C-x n' while searching.
>
> b. Show match numbers only for search hits within
> the region (has an effect only when search is
> limited to the region): option
> `isearchp-limit-match-numbers-to-region-flag' -
> toggle with `M-s %' while searching.
>
> c. Deactivate the region for Isearch: option
> `isearchp-deactivate-region-flag' - toggle with
> `C-SPC C-SPC' while searching.
>
> d. Select the last search or query-replace target,
> that is, make it the active region. Do this
> either per option `isearchp-set-region-flag'
> (toggle with `M-s M-SPC' while searching) or on
> demand: `isearchp-set-region-around-search-target'.
>
> e. Create a noncontiguous region from the
> lazy-highlighted text (search hits): `M-s z r'
> while searching.
>
> f. Add/remove a text property to/from the region.
> Search only areas that have that property with
> particular values. Works also for overlays.
>
> g. Search outside the area that would normally be
> searched (e.g. the region or a set of zones).
> That is, complement the search space. Toggle
> with `M-= ~' while searching.
>
> There are no doubt other ways the region can be
> used for Isearch. We should not assume that
> there's only one thing users might want to do
> with it. Keep their, and our, options open.
>
>[https://www.emacswiki.org/emacs/IsearchPlus]
>
Actually I am only considering the option of adding a new function and
bind it to M-s r.
Or add a C-something like isearch-yank-word-or-char.
(because I know that core option changes is complicated to agree in the
list, and I don't like to spend hours on that.)
next prev parent reply other threads:[~2019-04-30 16:57 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-27 0:14 isearch region or thing at point Ergus
2019-04-27 2:15 ` Basil L. Contovounesios
2019-04-29 0:41 ` Ergus
2019-04-29 1:30 ` Ergus
2019-04-29 1:31 ` Ergus
2019-04-29 19:41 ` Juri Linkov
2019-04-29 20:50 ` Ergus
2019-04-30 15:39 ` Drew Adams
2019-04-30 16:57 ` Ergus [this message]
2019-04-30 19:58 ` Juri Linkov
2019-04-30 16:25 ` Ergus
2019-04-30 18:49 ` Noam Postavsky
2019-04-30 19:03 ` Ergus
2019-04-30 19:24 ` Noam Postavsky
2019-04-30 20:05 ` Ergus
2019-04-30 20:38 ` Noam Postavsky
2019-04-30 22:39 ` Basil L. Contovounesios
2019-04-30 23:16 ` Ergus
2019-04-30 23:33 ` Basil L. Contovounesios
2019-05-01 0:13 ` Ergus
2019-05-01 20:57 ` Juri Linkov
2019-05-03 16:27 ` Basil L. Contovounesios
2019-05-01 11:20 ` Ergus
2019-05-01 14:33 ` Drew Adams
2019-05-01 16:03 ` Ergus
2019-05-01 16:25 ` Drew Adams
2019-05-03 16:28 ` Basil L. Contovounesios
2019-05-04 9:29 ` Eli Zaretskii
2019-05-03 16:28 ` Basil L. Contovounesios
2019-05-04 9:26 ` Eli Zaretskii
2019-05-04 12:15 ` Ergus
2019-05-04 14:17 ` Drew Adams
2019-05-04 14:56 ` Ergus
2019-05-04 15:24 ` Drew Adams
2019-05-04 21:06 ` Juri Linkov
2019-05-04 22:40 ` Drew Adams
2019-05-06 19:41 ` Juri Linkov
2019-05-07 2:56 ` Drew Adams
2019-05-07 19:56 ` Ergus
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=20190430165719.yrcvz6oq5ktkyuug@Ergus \
--to=spacibba@aol.com \
--cc=contovob@tcd.ie \
--cc=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=juri@linkov.net \
/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.