emacs-devel
[Top][All Lists]
Advanced

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

Re: Customizing faces with `defcustom'


From: martin rudalics
Subject: Re: Customizing faces with `defcustom'
Date: Sat, 12 Nov 2005 09:09:22 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

>     Consider, for example, the customization buffer for `matching':
>
> [Made by M-x customize-group RET matching RET]
>
>     (1) `match' stands out in `custom-face-tag-face', by default scaled by
>     1.2 and bold.
>
>     (2) `list-matching-lines-default-context-lines' is highlighted in
>     `custom-variable-tag-face', by default scaled by 1.2 and bold.
>
>
>     Then come the options
>
>     (3) `list-matching-lines-face' and
>     `list-matching-lines-buffer-name-face' both in default face.
>
> That is a real bug.  These are variables, and their names should be
> highlighted like all other variable names.
>
> I think this is a consequence of the following definition for
> widget type `face'.
>
>     (define-widget 'face 'symbol
>       "A Lisp face name (with sample)."
>       :format "%t: (%{sample%}) %v"
>       :tag "Face"
>       :value 'default
>       :sample-face-get 'widget-face-sample-face-get
>
> I think that this :sample-face-get definition is affecting the
> appearance of the variable's name.  The code in the definition of the
> `face' widget was adapted from the `color' widget.  I tried this
> example
>
>     (defcustom foocolor "black"
>       "Foo"
>       :type 'color)
>
> and saw the same problem occur.
>
> I think it is a bug that the :sample-face-get of the type has an
> effect on display of the variable name.  I would expect it to affect
> only where the value is displayed.  But I have never understood the
> widget code, so I have no idea how this happens.
>
> Can anyone figure out how to fix that?
>


The solution appears deceptively simple:

*** cus-edit.el Sat Nov  5 20:44:24 2005
--- cus-edit.el Fri Nov 11 18:32:56 2005
***************
*** 3397,3403 ****

  (define-widget 'face 'symbol
    "A Lisp face name (with sample)."
!   :format "%t: (%{sample%}) %v"
    :tag "Face"
    :value 'default
    :sample-face-get 'widget-face-sample-face-get
--- 3397,3403 ----

  (define-widget 'face 'symbol
    "A Lisp face name (with sample)."
!   :format "%{%t%}: (%{sample%}) %v"
    :tag "Face"
    :value 'default
    :sample-face-get 'widget-face-sample-face-get

*** wid-edit.el Sat Nov  5 20:44:42 2005
--- wid-edit.el Fri Nov 11 18:34:24 2005
***************
*** 3575,3581 ****
  ;; Fixme: match
  (define-widget 'color 'editable-field
    "Choose a color name (with sample)."
!   :format "%t: %v (%{sample%})\n"
    :size 10
    :tag "Color"
    :value "black"
--- 3575,3581 ----
  ;; Fixme: match
  (define-widget 'color 'editable-field
    "Choose a color name (with sample)."
!   :format "%{%t%}: %v (%{sample%})\n"
    :size 10
    :tag "Color"
    :value "black"





reply via email to

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