Re: Customizing cursor color

2006-04-21 Thread Richard Stallman
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.

Please do.

How about also changing defface so that gives an error
if the spec is nil?


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Customizing cursor color

2006-04-20 Thread Otto Maddox
The node Cursor Display in the emacs info pages says this:

You can customize the cursor's color, and whether it blinks, using the
`cursor' Custom group

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.

which says, to me, that I'm not supposed to use customize to set the
cursor color, contradicting what the manual is telling me.

In GNU Emacs 22.0.50.1 (powerpc-apple-darwin8.6.0)
 of 2006-04-19
X server distributor `Apple Computers', version 10.4.6
configured using `configure '--without-x' '--prefix=/usr/local''

-- 
http://www.fastmail.fm - Or how I learned to stop worrying and
  love email again



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: Customizing cursor color

2006-04-20 Thread Luc Teirlinck
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.el06 Feb 2006 16:01:46 -0600  1.348
--- faces.el20 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



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug