emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Customizing cursor color


From: Luc Teirlinck
Subject: Re: Customizing cursor color
Date: Thu, 20 Apr 2006 12:44:28 -0500 (CDT)

Otto Maddox wrote:

   so I go to the "cursor" customize group.  Next to the State button for
   Cursor face is this:

   NO CUSTOMIZATION DATA; not intended to be customized.

That is because the defface sets the cursor face to '(), that is, nil.
Custom stores that value in the `face-defface-spec' symbol property of
the symbol `cursor'.  But a nil value for a symbol property is
equivalent with no property.  Thus `cursor' has _no_ face-defface-spec
property, which tells Custom that it is not intended to be customized.
This apparently causes still other bugs in addition to the one you
reported.

For variables, Custom avoids this problem by storing the standard
value as a list with one element (the standard value).  Thus, if the
standard value is nil, Custom stores '(nil) in the standard-value
property, thereby avoiding the bugs for faces.

Apparently, Custom does not consider nil a valid value for a face.
If you erase all attributes of a face and then save it through Custom,
Custom will save it as '((t nil)).

I do not know whether nil actually is supposed to be a valid value for
a face, or whether one is supposed to always use '((t nil)) instead.

The simplest solution would be to simply replace all nil's in faces.el
with '((t nil)) which fixes the bug you reported and other ones.  The
patch below, which I could install if desired, implements this simple
solution.

If we really want to admit nil as a valid value, one could store
face-defface-spec as a list of one element, in analogy with
standard-value, but I believe that this would require quite some
rewriting.  Another solution would be to make Custom automatically
store '((t nil)) in face-defface-spec, if nil was specified in the
defface, but I am not sure that this could not yield unexpected
problems.

Patch:

===File ~/faces.el-diff-b===================================
*** faces.el    06 Feb 2006 16:01:46 -0600      1.348
--- faces.el    20 Apr 2006 12:00:05 -0500      
***************
*** 2143,2161 ****
    :group 'frames
    :group 'basic-faces)
  
! (defface scroll-bar '()
    "Basic face for the scroll bar colors under X."
    :version "21.1"
    :group 'frames
    :group 'basic-faces)
  
! (defface border '()
    "Basic face for the frame border under X."
    :version "21.1"
    :group 'frames
    :group 'basic-faces)
  
! (defface cursor '()
    "Basic face for the cursor color under X.
  Note: Other faces cannot inherit from the cursor face."
    :version "21.1"
--- 2143,2161 ----
    :group 'frames
    :group 'basic-faces)
  
! (defface scroll-bar '((t nil))
    "Basic face for the scroll bar colors under X."
    :version "21.1"
    :group 'frames
    :group 'basic-faces)
  
! (defface border '((t nil))
    "Basic face for the frame border under X."
    :version "21.1"
    :group 'frames
    :group 'basic-faces)
  
! (defface cursor '((t nil))
    "Basic face for the cursor color under X.
  Note: Other faces cannot inherit from the cursor face."
    :version "21.1"
***************
*** 2164,2170 ****
  
  (put 'cursor 'face-no-inherit t)
  
! (defface mouse '()
    "Basic face for the mouse color under X."
    :version "21.1"
    :group 'mouse
--- 2164,2170 ----
  
  (put 'cursor 'face-no-inherit t)
  
! (defface mouse '((t nil))
    "Basic face for the mouse color under X."
    :version "21.1"
    :group 'mouse
============================================================




reply via email to

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