unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: Phil Sainty <psainty@orcon.net.nz>,
	"73723@debbugs.gnu.org" <73723@debbugs.gnu.org>
Subject: bug#73723: 31.0.50; Add copy/kill/mark commands to isearch
Date: Thu, 10 Oct 2024 18:20:15 +0000	[thread overview]
Message-ID: <DS7PR10MB52327ED8230372CEB9CA1EEBF3782@DS7PR10MB5232.namprd10.prod.outlook.com> (raw)
In-Reply-To: <86cyk7zx7w.fsf@mail.linkov.net>

> >> It allows exiting Isearch with 'S-RET' that activates
> >> the region on the current match.  This allows using
> >> the standard keys afterwards: 'M-w' to copy the match,
> >> 'C-w' to kill the match, etc.
> >
> > FWIW, in isearch+.el I define `isearchp-kill-ring-save'
> > and bind it to `M-w'.
> > This has been the case since 2013.
> 
> Since `M-w' can't be used according to the comments in
> https://urldefense.com/v3/__https://old.reddit.com/r/emacs/comments/1fzv
> wig/copy_search_string_to_killring/__;!!ACWV5N9M2RV99hQ!L5HGxhm07QP4heBq
> z0oZG6Hs1DF2e5hty8aAHJG_sxr39y7pRCFJPoP2E_m9P8iyv-lGni4NgqrGZg$

I don't see anything there that says why `M-w' can't
be used.  What's the reason you think is given there?
Is it this?

  "I have muscle memory for pressing M-w to end the
   search and save the region from where point was
   before starting isearch to the location where the
   search string was found."

?

There are other ways to get the region to be from the
initial position to the end (if forward) or the start
(if backward) of the search match.

In any case, we are (should be) talking about default
key bindings (in `isearch-mode-map').  Both copying
the search match as a kill and setting the region to
origin-to-search-end are useful, and they can both have
default key bindings.  Which should be `M-w' by default
is something to decide.

You know what my recommendation is: copy the match.
IME, if someone wants to set the region from the initial
position they usually know that _before_ searching - in
which case it's enough to do `C-SPC' before searching.

* `M-w' _during_ search should copy the search match
because it can be done anytime _during_ a search.  It
can even be done multiple times _during_ a search, and
for the _same or different search patterns_.  It's a
very useful, versatile operation.

* `M-w' _after_ a search is something else, whether or
not you want to extend the region to initial position.

It makes no sense to use a key to set the region from
the initial position more than once during a search.
At most once per search is all you need, for that.

The question is whether to have a `isearch-mode-map'
key to _set the mark_ at the initial position (instead
of someone setting mark there before searching).

If we have such a key, then `M-w' _after_ the search
is just the _normal_ `M-w': `kill-ring-save'.  IOW,
we need not have a search-map key to set that region,
since that's done after searching (and once only).

To implement a command to _set mark_ at init position
during search we can always let-bind that position at
the outset, and then use it only when a user hits the
key to set the mark there (and that key shouldn't be
`M-w'.)

> what remains is `M-s M-w'.

Lots of possibilities remain.  But you might want to
use `M-s M-w' not for copying search matches but for
setting mark at the initial position.

Why?  See above: You only do that once, and you might
want to copy multiple (different) search matches to
the kill ring during the same search.  The key for
copying search matches should be `M-w' (IMO).





  reply	other threads:[~2024-10-10 18:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09 20:33 bug#73723: 31.0.50; Add copy/kill/mark commands to isearch Phil Sainty
2024-10-09 23:47 ` Stefan Kangas
2024-10-10  4:48 ` Eli Zaretskii
2024-10-10 12:10   ` Phil Sainty
2024-10-10  6:37 ` Juri Linkov
2024-10-10  7:38   ` Eli Zaretskii
2024-10-10 17:32     ` Juri Linkov
2024-10-10 16:58   ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-10 17:35     ` Juri Linkov
2024-10-10 18:20       ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-10-10 18:31         ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-10 18:41           ` Juri Linkov
2024-10-10 18:54             ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-10-10 18:40         ` Juri Linkov
2024-10-10 22:04 ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=DS7PR10MB52327ED8230372CEB9CA1EEBF3782@DS7PR10MB5232.namprd10.prod.outlook.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=73723@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=juri@linkov.net \
    --cc=psainty@orcon.net.nz \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).