* bug#24153: 25.1; Feature request: per-buffer cursor-color variable
@ 2016-08-04 15:08 Tej Chajed
2016-08-04 17:13 ` Eli Zaretskii
2016-08-05 1:21 ` npostavs
0 siblings, 2 replies; 9+ messages in thread
From: Tej Chajed @ 2016-08-04 15:08 UTC (permalink / raw)
To: 24153
Currently there's a per-buffer cursor-type variable that is respected
per window and a single cursor-color variable that applies to the
entire frame.
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).
It seems like the right way for evil to manage the cursor color is to
have an analogous per-buffer cursor-color variable natively provided
by emacs. Is this a doable feature?
Thanks!
Tej
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#24153: 25.1; Feature request: per-buffer cursor-color variable
2016-08-04 15:08 bug#24153: 25.1; Feature request: per-buffer cursor-color variable Tej Chajed
@ 2016-08-04 17:13 ` Eli Zaretskii
2016-08-05 1:21 ` npostavs
1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2016-08-04 17:13 UTC (permalink / raw)
To: Tej Chajed; +Cc: 24153
> From: Tej Chajed <tchajed@mit.edu>
> Date: Thu, 4 Aug 2016 11:08:12 -0400
>
> It seems like the right way for evil to manage the cursor color is to
> have an analogous per-buffer cursor-color variable natively provided
> by emacs. Is this a doable feature?
I don't see up front why not. Patches welcome.
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#24153: 25.1; Feature request: per-buffer cursor-color variable
2016-08-04 15:08 bug#24153: 25.1; Feature request: per-buffer cursor-color variable Tej Chajed
2016-08-04 17:13 ` Eli Zaretskii
@ 2016-08-05 1:21 ` npostavs
2016-08-05 2:17 ` Tej Chajed
2016-08-05 2:49 ` Clément Pit--Claudel
1 sibling, 2 replies; 9+ messages in thread
From: npostavs @ 2016-08-05 1:21 UTC (permalink / raw)
To: Tej Chajed; +Cc: 24153
Tej Chajed <tchajed@mit.edu> 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'? I find
in the docstring for that function:
Selections that "really count" are those causing a visible change in
the next redisplay of WINDOW’s frame and should be always recorded.
So if you think of running a function each time a window gets
selected put it on ‘buffer-list-update-hook’.
Perhaps using ‘buffer-list-update-hook’ instead of advising
`select-window' would help?
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#24153: 25.1; Feature request: per-buffer cursor-color variable
2016-08-05 1:21 ` npostavs
@ 2016-08-05 2:17 ` Tej Chajed
2016-08-05 16:37 ` martin rudalics
2016-08-06 2:10 ` Clément Pit--Claudel
2016-08-05 2:49 ` Clément Pit--Claudel
1 sibling, 2 replies; 9+ messages in thread
From: Tej Chajed @ 2016-08-05 2:17 UTC (permalink / raw)
To: npostavs; +Cc: 24153
On Thu, Aug 4, 2016 at 9:21 PM, <npostavs@users.sourceforge.net> wrote:
> Tej Chajed <tchajed@mit.edu> 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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#24153: 25.1; Feature request: per-buffer cursor-color variable
2016-08-05 2:17 ` Tej Chajed
@ 2016-08-05 16:37 ` martin rudalics
2016-08-06 2:10 ` Clément Pit--Claudel
1 sibling, 0 replies; 9+ messages in thread
From: martin rudalics @ 2016-08-05 16:37 UTC (permalink / raw)
To: Tej Chajed, npostavs; +Cc: 24153
>>> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#24153: 25.1; Feature request: per-buffer cursor-color variable
2016-08-05 2:17 ` Tej Chajed
2016-08-05 16:37 ` martin rudalics
@ 2016-08-06 2:10 ` Clément Pit--Claudel
1 sibling, 0 replies; 9+ messages in thread
From: Clément Pit--Claudel @ 2016-08-06 2:10 UTC (permalink / raw)
To: 24153
[-- Attachment #1.1: Type: text/plain, Size: 596 bytes --]
On 2016-08-04 22:17, Tej Chajed wrote:
>>> 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.
IIRC I added this save-window-excursion call to work a Proof General issue, back when I didn't know much about PG. Now that I have commit rights there, I could probably move the fix upstream and remove the save-window-excursion call.
Clément.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#24153: 25.1; Feature request: per-buffer cursor-color variable
2016-08-05 1:21 ` npostavs
2016-08-05 2:17 ` Tej Chajed
@ 2016-08-05 2:49 ` Clément Pit--Claudel
2016-08-05 16:37 ` martin rudalics
1 sibling, 1 reply; 9+ messages in thread
From: Clément Pit--Claudel @ 2016-08-05 2:49 UTC (permalink / raw)
To: 24153, npostavs
[-- Attachment #1.1: Type: text/plain, Size: 642 bytes --]
On 2016-08-04 21:21, npostavs@users.sourceforge.net wrote:
> Perhaps using ‘buffer-list-update-hook’ instead of advising
> `select-window' would help?
Hmmm. I don't think that would work.
Assume there are two windows, one showing a buffer in evil's normal editing mode, and one showing a buffer in evil's edit mode. If the user has configured evil to show the normal-mode cursor in green and the insert-mode cursor in purple, then evil needs to change the cursor color every time the user switches between these two windows, and (I don't think that) buffer-list-update-hook won't be sufficient for that.
Cheers,
Clément.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#24153: 25.1; Feature request: per-buffer cursor-color variable
2016-08-05 2:49 ` Clément Pit--Claudel
@ 2016-08-05 16:37 ` martin rudalics
2016-08-06 1:59 ` Clément Pit--Claudel
0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2016-08-05 16:37 UTC (permalink / raw)
To: Clément Pit--Claudel, 24153, npostavs
> Assume there are two windows, one showing a buffer in evil's normal
> editing mode, and one showing a buffer in evil's edit mode. If the
> user has configured evil to show the normal-mode cursor in green and
> the insert-mode cursor in purple, then evil needs to change the cursor
> color every time the user switches between these two windows, and (I
> don't think that) buffer-list-update-hook won't be sufficient for
> that.
This would be a bug. ‘select-window’ should always run
‘buffer-list-update-hook’ when NORECORD is nil.
martin
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#24153: 25.1; Feature request: per-buffer cursor-color variable
2016-08-05 16:37 ` martin rudalics
@ 2016-08-06 1:59 ` Clément Pit--Claudel
0 siblings, 0 replies; 9+ messages in thread
From: Clément Pit--Claudel @ 2016-08-06 1:59 UTC (permalink / raw)
To: martin rudalics, 24153, npostavs
[-- Attachment #1.1: Type: text/plain, Size: 649 bytes --]
On 2016-08-05 12:37, martin rudalics wrote:
>> Assume there are two windows, one showing a buffer in evil's normal
>> editing mode, and one showing a buffer in evil's edit mode. If the
>> user has configured evil to show the normal-mode cursor in green and
>> the insert-mode cursor in purple, then evil needs to change the cursor
>> color every time the user switches between these two windows, and (I
>> don't think that) buffer-list-update-hook won't be sufficient for
>> that.
>
> This would be a bug. ‘select-window’ should always run
> ‘buffer-list-update-hook’ when NORECORD is nil.
I see; thanks for clarifying!
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-08-06 2:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-04 15:08 bug#24153: 25.1; Feature request: per-buffer cursor-color variable Tej Chajed
2016-08-04 17:13 ` Eli Zaretskii
2016-08-05 1:21 ` npostavs
2016-08-05 2:17 ` Tej Chajed
2016-08-05 16:37 ` martin rudalics
2016-08-06 2:10 ` Clément Pit--Claudel
2016-08-05 2:49 ` Clément Pit--Claudel
2016-08-05 16:37 ` martin rudalics
2016-08-06 1:59 ` Clément Pit--Claudel
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).