Subject: Re: bug#24153: 25.1; Feature request: per-buffer cursor-color variable

From: martin rudalics <[email-masked]>
Date: Fri, 05 Aug 2016 18:37:11 +0200

>>> Evil emulates a per-window cursor color in order to have the cursor
 >>> color of the active window reflect the buffer state (eg,
 >>> distinguishing insert and normal mode). It does so by advising
 >>> set-window and calling set-cursor-color if necessary; this can lead to
 >>> slowdowns when code calls set-window repeatedly (eg, through
 >>> with-selected-window).
 >>
 >> There's no `set-window' function, did you mean `select-window'?
 >
 > Yes, my mistake - the advice is on select-window.
 >
 >>
 >> Perhaps using ‘buffer-list-update-hook’ instead of advising
 >> `select-window' would help?
 >
 > I haven't fully debugged this alternative, but it doesn't seem to
 > work. company-coq still uses save-window-excursion in
 > company-coq-ask-prover, which triggers the buffer-list-update-hook.

Please tell us more about where and why ‘buffer-list-update-hook’
doesn't work in any of your use cases.  From what you say here you
expect ‘save-window-excursion’ to _not_ run ‘buffer-list-update-hook’.
Is that correct?

 > In
 > addition, even with company-coq disabled this somehow doesn't call
 > evil-refresh-cursor enough; starting from insert mode, after the first
 > proof command, the color gets stuck on the normal mode color, and then
 > doesn't change until some other buffer list update.

But IIUC you do not set the buffer of any window in these steps, so why
would you expect ‘buffer-list-update-hook’ to run?

martin