Juri Linkov <juri@linkov.net> writes:
I've updated the patch which should use the mode hook instead using
post-command-hook or idle timers (and allows (implicitly) to user use
post-command-hook (but that is user responsibility add it or not)).
Also this should refresh the cursor while switching windows.
However I've deleted the function/lambdas support as conditions because
i found it problematic.
I've test it only for overwrite-mode, I ask if anyone wants to give it a
try.
Please note that this is insufficient for 'repeat-mode'.
Currently it requires adding an advice to update the cursor
on the repeat timer events:
(add-function :after repeat-echo-function #'cursor-indicators–update-indications)
since need to update the cursor when the timer is fired:
(run-with-idle-timer timeout nil #'repeat-exit)
(defun repeat-exit ()
(setq repeat-in-progress nil)
(funcall repeat-echo-function nil))
This problem can be solved by adding a hook:
(defun repeat-exit ()
(setq repeat-in-progress nil)
(funcall repeat-echo-function nil)
(run-hooks 'repeat-exit-hook))
Then 'cursor-indicators-mode' needs to add this hook:
(define-minor-mode cursor-indicators-mode
…
(add-hook 'repeat-exit-hook #'cursor-indicators–update-indications)
Then maybe it's possible to add more hooks for other features as well.
The drawback of this approach is that specific hooks make the cursor updating
less reliable than with using post-command-hook.
Well, then I think the best solution for this would be to make this
package (cursor-indicators) part of the C code.
I'll see what I can do.