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

From: Tej Chajed <[email-masked]>
Date: Thu, 4 Aug 2016 22:17:04 -0400

On Thu, Aug 4, 2016 at 9:21 PM,  <[email-masked]> wrote:
> Tej Chajed <[email-masked]> writes:
>>
>> 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. 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.