From: Tino Calancha <tino.calancha@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: spacibba@aol.com, npostavs@gmail.com, 39512@debbugs.gnu.org,
contovob@tcd.ie
Subject: bug#39512: 28.0.50; Add command isearch-yank-region
Date: Sun, 09 Feb 2020 12:21:10 +0100 [thread overview]
Message-ID: <87blq82ehl.fsf@calancha-pc.dy.bbexcite.jp> (raw)
In-Reply-To: <877e0wiosp.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 09 Feb 2020 02:31:50 +0200")
Juri Linkov <juri@linkov.net> writes:
>> During an incremental search, this command appends the region
>> to the search string. Otherwise, start an incremental search
>> using the region as the search string.
>
> What use cases do you think it could be used for?
> I don't see any useful case for appending the region to the search string.
Me either. I believe I have copied such an append wording from
elsewhere. What I have in mind is just to set the search string = to
the region.
> I see only 2 useful cases that don't append the region to the search string:
>
> 1. Before starting isearch, the user selects the region,
> then types a special command bound to a key on the global `M-s' prefix
> that yanks the region to the initially empty search string
> (i.e. it doesn't append, it replaces the empty search string)
> 2. The second useful case is to activate the region, start isearch,
> use isearch to find the string at the region end, thus moving the region end
> to a new position, replace (don't append) the search string with region text -
> this is what isearch-yank-region could do.
> IOW, sync the region with the search string.
I was motivated with a scenario similar to 1.
1. I select a region that I want to search for
2. C-s ; I start an interactive search
3. `some keybinding here'; that sets the search string = to the region.
I think on 3. as an alternative of `isearch-yank-until-char' (and
family). Sure, having the command to start the search directly with a
M-s prefix is desirable too.
My mind finds easy to remember that I always can do the patter:
C-s
;; Now some keybinding that sets the search string with `isearch-yank- (whatever)
>> +(defun isearch-yank-region ()
>> + "Pull region into search string.
>> +If called out of an incremental search, then start an incremental
>> +search with the region as the search string."
>> + (interactive)
>> + (cond ((use-region-p)
>> + (unless isearch-mode (isearch-mode t))
>> + (isearch-yank-string (funcall region-extract-function))
>
> Here (funcall region-extract-function) signals the error
>
> (wrong-number-of-arguments (1 . 1) 0)
>
> Have you tested your patch?
Opps, I tested without emacs -Q. sorry for that! I have some advice
in that function that lets me call it with no arguments.
next prev parent reply other threads:[~2020-02-09 11:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-08 18:04 bug#39512: 28.0.50; Add command isearch-yank-region Tino Calancha
2020-02-08 23:47 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-02-09 0:31 ` Juri Linkov
2020-02-09 11:21 ` Tino Calancha [this message]
2020-02-09 12:38 ` Tino Calancha
2020-02-10 0:45 ` Juri Linkov
2020-02-12 22:10 ` Juri Linkov
2020-08-09 11:28 ` Lars Ingebrigtsen
2020-08-09 23:23 ` Juri Linkov
2020-08-10 1:19 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-10 23:49 ` Juri Linkov
2020-08-11 1:12 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-11 23:13 ` Juri Linkov
2020-08-12 17:41 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-12 23:44 ` Juri Linkov
2020-08-13 3:14 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-15 20:52 ` Juri Linkov
2021-04-18 15:34 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-20 20:29 ` Juri Linkov
2021-04-21 20:41 ` Juri Linkov
2020-08-10 17:00 ` Tino Calancha
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=87blq82ehl.fsf@calancha-pc.dy.bbexcite.jp \
--to=tino.calancha@gmail.com \
--cc=39512@debbugs.gnu.org \
--cc=contovob@tcd.ie \
--cc=juri@linkov.net \
--cc=npostavs@gmail.com \
--cc=spacibba@aol.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 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).