* Temporarily overriding cursor color?
@ 2015-02-05 13:03 David Kastrup
2015-02-05 16:18 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: David Kastrup @ 2015-02-05 13:03 UTC (permalink / raw)
To: emacs-devel
(let ((cookie (face-remap-add-relative 'cursor :background "red")))
(recursive-edit)
(face-remap-remove-relative cookie))
does not appear to do anything. Any idea why?
--
David Kastrup
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Temporarily overriding cursor color?
2015-02-05 13:03 Temporarily overriding cursor color? David Kastrup
@ 2015-02-05 16:18 ` Eli Zaretskii
2015-02-05 16:36 ` David Kastrup
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2015-02-05 16:18 UTC (permalink / raw)
To: David Kastrup; +Cc: emacs-devel
> From: David Kastrup <dak@gnu.org>
> Date: Thu, 05 Feb 2015 14:03:10 +0100
>
>
> (let ((cookie (face-remap-add-relative 'cursor :background "red")))
> (recursive-edit)
> (face-remap-remove-relative cookie))
>
> does not appear to do anything. Any idea why?
'cursor' is not really a face used by the Emacs display. It's more
like a handle to inject the 'cursor-color' parameter into a frame's
parameter alist. And there's no code to do that when you remap the
'cursor' face, so the above has no effect.
By contrast, when you use (for example) set-face-background to change
the 'cursor' face, that function eventually calls
get_lface_attributes, which handles this face specially, see there.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Temporarily overriding cursor color?
2015-02-05 16:18 ` Eli Zaretskii
@ 2015-02-05 16:36 ` David Kastrup
2015-02-05 16:58 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: David Kastrup @ 2015-02-05 16:36 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Kastrup <dak@gnu.org>
>> Date: Thu, 05 Feb 2015 14:03:10 +0100
>>
>>
>> (let ((cookie (face-remap-add-relative 'cursor :background "red")))
>> (recursive-edit)
>> (face-remap-remove-relative cookie))
>>
>> does not appear to do anything. Any idea why?
>
> 'cursor' is not really a face used by the Emacs display. It's more
> like a handle to inject the 'cursor-color' parameter into a frame's
> parameter alist. And there's no code to do that when you remap the
> 'cursor' face, so the above has no effect.
>
> By contrast, when you use (for example) set-face-background to change
> the 'cursor' face, that function eventually calls
> get_lface_attributes, which handles this face specially, see there.
But that happens per-frame rather than per-buffer. The point of face
remapping is to be able to do buffer-local modifications. Basically, I
was thinking of a "recording" indicator, functionally somewhat akin to
the "Def" lighter in the modeline that C-x ( puts up, just more direct.
I think in MSDOS times the equivalent of the "Ovwrt" lighter was
expressed in cursor shape.
Since the recording is done using a buffer-local keymap, keeping the
indicator buffer-local makes sense.
The question is whether my expectations here were unreasonable or
whether it would be unreasonably expensive to match them. Of course, if
the only cursor aspect that can be face-controlled is its color, it
would seem somewhat lacklustre to invest the work for making this single
cursor-parameter controllable per-buffer.
--
David Kastrup
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Temporarily overriding cursor color?
2015-02-05 16:36 ` David Kastrup
@ 2015-02-05 16:58 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2015-02-05 16:58 UTC (permalink / raw)
To: David Kastrup; +Cc: emacs-devel
> From: David Kastrup <dak@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Thu, 05 Feb 2015 17:36:08 +0100
>
> > 'cursor' is not really a face used by the Emacs display. It's more
> > like a handle to inject the 'cursor-color' parameter into a frame's
> > parameter alist. And there's no code to do that when you remap the
> > 'cursor' face, so the above has no effect.
> >
> > By contrast, when you use (for example) set-face-background to change
> > the 'cursor' face, that function eventually calls
> > get_lface_attributes, which handles this face specially, see there.
>
> But that happens per-frame rather than per-buffer.
I didn't mean that set-face-background can replace face remapping. I
just explained how come set-face-background succeeds in changing the
cursor colors, while face remapping doesn't.
> The question is whether my expectations here were unreasonable or
> whether it would be unreasonably expensive to match them.
I wouldn't say "expensive", but the changes in code will be more than
just call a function in face-remap-add-relative or some such. You
need to plug in face lookup into the code that draw the cursor.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-02-05 16:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-05 13:03 Temporarily overriding cursor color? David Kastrup
2015-02-05 16:18 ` Eli Zaretskii
2015-02-05 16:36 ` David Kastrup
2015-02-05 16:58 ` Eli Zaretskii
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).