From: Juri Linkov <juri@linkov.net>
To: Augusto Stoffel <arstoffel@gmail.com>
Cc: 53126@debbugs.gnu.org
Subject: bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc.
Date: Tue, 15 Mar 2022 19:09:49 +0200 [thread overview]
Message-ID: <86zglrl4gq.fsf@mail.linkov.net> (raw)
In-Reply-To: <87mtidip1w.fsf@gmail.com> (Augusto Stoffel's message of "Sat, 26 Feb 2022 17:13:31 +0100")
> Inlined below some further comments.
>
>>>> I meant using simply
>>>>
>>>> (add-hook 'minibuffer-setup-hook 'isearch-read-with-highlight-setup)
>>>>
>>>> But it seems isearch-read-with-highlight-setup doesn't set
>>>> isearch-lazy-count-display-function.
>
> What used to be 'isearch-read-with-highlight-setup' is now
> 'minibuffer-lazy-highlight-setup'.
>
> Just to make sure I understood you: your suggestion is for this function
> to remove itself automagically from the minibuffer setup hook, to
> dispense with the need of 'minibuffer-with-setup-hook'? This seems
> handy but unusual, hence my question.
> ...
> - In a previous message, you seemed to suggest making
> `minibuffer-lazy-highlight-setup' self-cleaning form the
> minibuffer-setup-hook, so as to dispense with the need for
> `with-minibuffer-setup-hook'. I did exactly that, but since I haven't
> seen this convention before, I wanted to double check.
Actually, my comment was about having the line that you already added
in your latest patch in 'minibuffer-lazy-highlight-setup':
(add-hook 'lazy-count-update-hook #'minibuffer-lazy-highlight--count)
So I don't see the need to have this line:
(remove-hook 'minibuffer-setup-hook #'minibuffer-lazy-highlight-setup)
Also I noticed that you changed the function 'isearch-lazy-count-display-function'
to the hook 'lazy-count-update-hook', and this looks fine,
I see no problem with this.
> - Besides query-replace, I only added lazy highlight to
> isearch-edit-string for now.
BTW, what is the relation between the minibuffer-lazy-highlight feature
and another proposed feature that immediately updates the search in
the buffer while editing the string in the minibuffer by isearch-edit-string?
Can minibuffer-lazy-highlight be considered as a lightweight version of
the buffer search from the minibuffer?
> There are a few more we could add (perhaps later),
> such as `occur' and `keep-lines'.
I tried (add-hook 'minibuffer-setup-hook #'minibuffer-lazy-highlight-setup)
in the minibuffer of 'occur' and others, and it works nicely.
Maybe it could even semi-deprecate the package re-builder.el.
Thanks for this generally usable feature.
> - There's no customization variable to enable the minibuffer lazy
> highlight. The rationale is that each command that will use it should
> define its own user option (or use an existing one). For
> `isearch-edit-string' it's `isearch-lazy-highlight'; for
> `query-replace' it's `query-replace-lazy-highlight'; and so on.
A common customizable option to enable this everywhere would be nice too.
Maybe disabling is already possible by customizing
'minibuffer-lazy-count-format' to nil? Then the checks for
non-nil 'minibuffer-lazy-count-format' could be added to
more places, such as to wrap the whole '(condition-case error'
in query-replace-read-args with the 'when' condition, etc.
> - As to the lazy count during `perform-replace': I would like to leave
> this for later. In fact, I think the lazy highlight has some issues
> that need fixing beforehand. For instance, if I replace "a" with
> "aba", then the "a"'s from the replacement text also get lazy
> highlighted. We shouldn't refresh the lazy highlight during
> `preform-replace'. Then adding lazy count on top should be easy.
Patches welcome.
>>> I guess this could be done.
>>
>> Maybe two separate hooks could be defined? One highlights like
>> lazy-highlight, and another counts like lazy-count does:
>>
>> (add-hook 'minibuffer-setup-hook 'isearch-read-with-highlight-setup)
>> (add-hook 'minibuffer-setup-hook 'isearch-read-with-count-setup)
>
> The highlight without counting can be achieved by binding a suitable new
> variable. Counting without highlight is not supported by isearch AFAIU.
Counting without highlighting is only possible by redefining the function
'isearch-lazy-highlight-match' to a no-op function.
next prev parent reply other threads:[~2022-03-15 17:09 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-08 13:24 bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc Augusto Stoffel
2022-01-08 18:59 ` Juri Linkov
2022-01-08 19:35 ` Augusto Stoffel
2022-01-09 9:10 ` Juri Linkov
2022-01-09 10:02 ` Augusto Stoffel
2022-01-09 10:30 ` Augusto Stoffel
2022-01-09 18:58 ` Juri Linkov
2022-01-10 17:34 ` Augusto Stoffel
2022-01-10 19:09 ` Juri Linkov
2022-02-26 16:13 ` Augusto Stoffel
2022-03-15 17:09 ` Juri Linkov [this message]
2022-03-15 21:33 ` Augusto Stoffel
2022-03-16 18:56 ` Juri Linkov
2022-03-16 20:09 ` Augusto Stoffel
2022-03-17 17:09 ` Juri Linkov
2022-03-17 19:10 ` Augusto Stoffel
2022-03-17 20:40 ` Juri Linkov
2022-03-17 21:42 ` Augusto Stoffel
2022-03-20 9:38 ` Augusto Stoffel
2022-03-20 18:51 ` Juri Linkov
2022-03-24 19:03 ` Augusto Stoffel
2022-03-25 8:39 ` Juri Linkov
2022-03-25 9:43 ` Augusto Stoffel
2022-03-27 7:46 ` Juri Linkov
2022-04-01 9:06 ` Augusto Stoffel
2022-04-01 16:35 ` Juri Linkov
2022-04-01 18:12 ` Augusto Stoffel
2022-04-02 18:23 ` Juri Linkov
2022-04-03 8:32 ` Augusto Stoffel
2022-04-03 17:06 ` Juri Linkov
2022-04-04 16:37 ` Juri Linkov
2022-04-05 16:38 ` Augusto Stoffel
2022-04-05 17:12 ` Juri Linkov
2022-04-07 19:32 ` Augusto Stoffel
2022-04-08 7:32 ` Juri Linkov
2022-04-08 7:53 ` Augusto Stoffel
2022-04-09 11:06 ` Augusto Stoffel
2022-04-10 19:38 ` Juri Linkov
2022-03-15 17:24 ` Juri Linkov
2022-03-15 21:21 ` Augusto Stoffel
2022-03-16 19:02 ` Juri Linkov
2022-03-16 20:25 ` Augusto Stoffel
2022-03-17 17:05 ` Juri Linkov
2022-03-17 19:06 ` Augusto Stoffel
2022-03-20 19:24 ` Juri Linkov
2022-03-20 19:59 ` Augusto Stoffel
2022-03-20 20:29 ` Juri Linkov
2022-03-20 20:56 ` Augusto Stoffel
2022-03-23 18:20 ` Juri Linkov
2022-03-23 18:54 ` Augusto Stoffel
2022-03-23 19:17 ` Eli Zaretskii
2022-03-23 19:53 ` Juri Linkov
2022-03-23 20:06 ` Juri Linkov
2022-03-23 20:30 ` Augusto Stoffel
2022-03-23 20:43 ` Juri Linkov
2022-03-17 19:45 ` Augusto Stoffel
2022-03-17 20:43 ` Juri Linkov
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=86zglrl4gq.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=53126@debbugs.gnu.org \
--cc=arstoffel@gmail.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).