[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: isearch region or thing at point.
From: |
Drew Adams |
Subject: |
RE: isearch region or thing at point. |
Date: |
Sat, 4 May 2019 08:24:21 -0700 (PDT) |
> >> This patch has changed a lot because some others made suggestions I
> >> considered useful. I will attach the new patch in another mail.
> >>
> >> On the other hand it makes sense that M-w should be used in case the
> >> user wants to add the text in the minibuffer to the kill-ring.
> >> (Something like isearchp-kill-ring-save)
> >>
> >> So maybe M-r (region) or M-i (insert) must be used for what I propose
> >> and Drew may add the isearch-kill-ring-save function he wrote and bind
> >> it to M-w. That way there will be all the copy functionalities in place.
> >
> >I would prefer that, yes. `M-w' to copy to the
> >kill-ring (as usual).
> >
> >Do you need an actual patch to include the command
> >I sent, or can you please just include it (renaming
> >prefix `isearchp-' to `isearch-')?
>
> >> But then we must recommend bind M-r or M-i (or whatever) for similar
> >> functionalities. And if possible correct other modes to be consistent
> >> with that (if that does not start a religious war here please).
>
> There are similar modes with commands to copy text from region into
> minibuffer and all them use different bindings. I just propose to unify
> that somehow when possible.
>
> >Sorry, I don't know what you mean, there. `M-r' is
> >(and has long been) `isearch-toggle-regexp'.
>
> Sorry, I forgot that, So the only alternative is M-i.
There are other alternatives, too (but I'm not saying
they are necessarily better). We have prefix `M-s',
for example.
But aside from a few, I prefer that we use it for
toggle commands. Vanilla Emacs uses it for these:
M-s C-e isearch-yank-line
M-s SPC isearch-toggle-lax-whitespace
M-s ' isearch-toggle-char-fold
M-s _ isearch-toggle-symbol
M-s c isearch-toggle-case-fold
M-s e isearch-edit-string
M-s h r isearch-highlight-regexp
M-s i isearch-toggle-invisible
M-s o isearch-occur
M-s r isearch-toggle-regexp
M-s w isearch-toggle-word
(Note that we already give 2 bindings to
`isearch-toggle-case-fold', which we need not do.)
And Isearch+ uses `M-s' additionally for these:
M-s M-SPC isearchp-toggle-set-region
M-s M-k isearchp-toggle-repeat-search-if-fail
M-s # isearchp-toggle-showing-match-number
M-s % isearchp-toggle-limit-match-numbers-to-region
M-s h L isearchp-toggle-lazy-highlighting
M-s h R isearchp-toggle-highlighting-regexp-groups
M-s h b isearchp-toggle-lazy-highlight-full-buffer
M-s h d isearchp-toggle-dimming-filter-failures
M-s h f isearchp-highlight-matches-other-face
M-s h h hlt-highlight-isearch-matches
M-s h l isearchp-toggle-lazy-highlight-cleanup
M-s h u hlt-unhighlight-isearch-matches
M-s u f isearchp-unhighlight-last-face
M-s v isearchp-toggle-option-toggle
> >> I will try to do the same for replace-like commands.
> >
> >(Not sure what you mean by that, either.)
>
> When region is active; replace-string (and related) limits the replaces
> to the active region. But alternatively we could provide a simple hint
> that inserts the region text into minibuffer and deactivate it, so
> instead of limiting the replace to the region, the region can be used as
> the string to replace.
>
> M-w M-% C-y RET => M-% M-i
>
> Or similar.
Got it. I agree that for Isearch and other things,
such as replacement, there are at least those two
very different ways to use the active region:
1. Copy its content to the kill ring (or the secondary
selection or a register or...).
2. Limit the action to the region (e.g., limit search
or replacement to the region).
That was in fact one of the points underlying my
message, though I didn't state it explicitly.
Replacement commands already let you limit the action
to the active region, even in vanilla Emacs.
Isearch+ (but not yet vanilla Isearch) also lets you
limit the search to the active region.
And in general when the region is active, the typical
change in behavior a command makes is to act on the
region instead of the whole buffer or the part of it
following point.
I agree that it might be good to have key bindings
that consistently reflect this difference - these
two different ways to use the active region.
There are additional ways in which a command can
make use of the active region, of course. But these
two stand out as fairly general possibilities.
It would be good to "standardize" bindings - say
reserve `M-w' (e.g. on a prefix key) for the
"copy-region" (or similar) action, and find another
key (e.g. on a prefix key) for the "limit-to-region"
action.
- RE: isearch region or thing at point., (continued)
- RE: isearch region or thing at point., Drew Adams, 2019/05/01
- Re: isearch region or thing at point., Basil L. Contovounesios, 2019/05/03
- Re: isearch region or thing at point., Eli Zaretskii, 2019/05/04
- Re: isearch region or thing at point., Ergus, 2019/05/04
- RE: isearch region or thing at point., Drew Adams, 2019/05/04
- Re: isearch region or thing at point., Ergus, 2019/05/04
- RE: isearch region or thing at point.,
Drew Adams <=
- Re: isearch region or thing at point., Juri Linkov, 2019/05/04
- RE: isearch region or thing at point., Drew Adams, 2019/05/04
- Re: isearch region or thing at point., Juri Linkov, 2019/05/06
- RE: isearch region or thing at point., Drew Adams, 2019/05/06
- RE: isearch region or thing at point., Ergus, 2019/05/07
Re: isearch region or thing at point., Juri Linkov, 2019/05/01
Re: isearch region or thing at point., Basil L. Contovounesios, 2019/05/03