Subject: Re: bug#39512: 28.0.50; Add command isearch-yank-region

From: Juri Linkov <[email-masked]>
Date: Mon, 10 Feb 2020 02:45:17 +0200

> I have added global keybinding `M-s M-.' for my `isearch-yank-region'.

Thanks.

> `isearch-yank-kill' and `isearch-yank-region' are good names for the
> use case of calling them once we are in an interactive search.
>
> The names are not any good for the use case of calling them directly
> (from a global keybinding).  We might want:
>
> 1. aliases `isearch-forward-kill', `isearch-forward-region'

Aliases might add more confusion and make impression that
these are separate commands when displayed in a list of isearch commands,
e.g. in completion list, in documentation.

> 2. restrict the use of them for just inside the interactive search, and
>    define the new commands (`isearch-forward-kill',`isearch-forward-region')
>    as those calling `isearch-mode' at the beginning.

Restricting would be worse.

So maybe `isearch-yank-kill' and `isearch-yank-region' still are
not too bad names to use as entry points to enable isearch mode.

> +    (define-key map    "\M-." 'isearch-yank-region)

Some doubts are about `M-.' - what if some users might want to use `M-.'
to exit isearch and run its global binding `xref-find-definitions'
on the found symbol?  Maybe better to bind `isearch-yank-region'
to `M-s M-.' in isearch-mode too?

> I have some advice in that function that lets me call it with no arguments.

Maybe a new function could be added as a wrapper around
`(funcall region-extract-function)' and with its argument optional.