[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-repl
From: |
Juri Linkov |
Subject: |
bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc. |
Date: |
Mon, 04 Apr 2022 19:37:10 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
> I've attached a sketch of a macro to help activating the minibuffer lazy
> highlight. It doesn't make query-replace-read-args exactly short, but
> if you like this, I can prepare the patch.
I realized we already have the macro minibuffer-with-setup-hook,
so we don't need more macros.
The purpose of minibuffer-with-setup-hook is to set up the minibuffer
to the initial state with buffer-local variables. In case of
lazy-highlighting, we can't set isearch variables directly,
but all isearch variables can be replaced by one variable
that contains a set of lazy-highlight parameters. For example:
(minibuffer-with-setup-hook
(lambda ()
(setq-local lazy-highlight-params
`((case-fold ,case-fold-search)
(regexp ,regexp-flag)
(regexp-function ,(or replace-regexp-function
(and current-prefix-arg
(not (eq current-prefix-arg
'-)))
(and replace-char-fold
(not regexp-flag)
#'char-fold-to-regexp)))))
(minibuffer-lazy-highlight-init))
(query-replace-read-from prompt regexp-flag))
where minibuffer-lazy-highlight-init does a little more than
minibuffer-lazy-highlight-setup. Or maybe it's not needed,
and minibuffer-lazy-highlight-setup should be enough.
Or maybe instead of setq-local is can let-bind variables.
Please also note that condition-case can be replaced by
a hook in minibuffer-exit-hook that can remove highlighting
after exiting the minibuffer.
Alternatively, the same lambda above could be added to
(add-hook 'minibuffer-setup-hook (lambda () ...))
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Augusto Stoffel, 2022/04/01
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Juri Linkov, 2022/04/01
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Augusto Stoffel, 2022/04/01
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Juri Linkov, 2022/04/02
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Augusto Stoffel, 2022/04/03
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Juri Linkov, 2022/04/03
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc.,
Juri Linkov <=
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Augusto Stoffel, 2022/04/05
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Juri Linkov, 2022/04/05
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Augusto Stoffel, 2022/04/07
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Juri Linkov, 2022/04/08
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Augusto Stoffel, 2022/04/08
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Augusto Stoffel, 2022/04/09
- bug#53126: 29.0.50; [PATCH] Lazy highlight/count when reading query-replace string, etc., Juri Linkov, 2022/04/10