GNU bug report logs -
#53126
29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc.
Previous Next
Reported by: Augusto Stoffel <arstoffel <at> gmail.com>
Date: Sat, 8 Jan 2022 13:25:01 UTC
Severity: normal
Tags: patch
Merged with 53341
Fixed in version 29.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> So I don't see the need to have this line:
>>
>> (remove-hook 'minibuffer-setup-hook #'minibuffer-lazy-highlight-setup)
>
> Okay, but if I remove this line, then all calls to
> minibuffer-lazy-highlight-setup will require a with-minibuffer-setup
> hook. And this will be awkward:
>
> (minibuffer-with-setup-hook (if isearch-lazy-highlight
> #'minibuffer-lazy-highlight-setup
> #'ignore)
> (read-from-minibuffer "Something: "))
The answer depends on another question: how do you intend the users
would enable this feature? When to enable it in all minibuffers
(like e.g. minibuffer-depth-indicate-mode does) the users will add
to their init files:
(add-hook 'minibuffer-setup-hook #'minibuffer-lazy-highlight-setup)
Then removing the user's customization would not be a nice thing to do.
OTOH, minibuffer-with-setup-hook will remove only own hook, not the user's one.
So to allow enabling this feature selectively, minibuffer-with-setup-hook
is not quite awkward.
>> 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?
>
> Well, there's a package for that on ELPA (isearch-mb), so extending
> isearch-edit-string to do that seems superfluous now?
It's still possible to add this feature to isearch-edit-string,
when the change would not be too enormous. I recall squeezing
it into a small patch, but unfortunately it requires changes
in keymap priorities.
>>> 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.
>
> By the way, this is a byproduct of that long discussion that led to
> isearch-mb, so it was not all in vain :-).
Are you sure these features can't be combined? One feature basically
runs isearch-search-and-update in the buffer from the minibuffer,
and this feature runs isearch-lazy-highlight-new-loop.
>>> - 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.
>
> Yes, the user can set minibuffer-lazy-count-format to nil to get rid of
> the lazy count.
>
> Concerning query-replace, why would anyone want to have lazy highlight
> during the perform-replace loop, but not earlier? I'm not a fan of
> adding a custom option here, not because it would be hard, but because
> it seems totally unnecessary.
Maybe a new option would make sense for the same reason why there is
the option isearch-lazy-count?
This bug report was last modified 3 years and 38 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.