emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Temporarily overriding cursor color?


From: David Kastrup
Subject: Re: Temporarily overriding cursor color?
Date: Thu, 05 Feb 2015 17:36:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: David Kastrup <address@hidden>
>> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]