emacs-devel
[Top][All Lists]
Advanced

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

Re: custom-link vs custom-button face


From: Juri Linkov
Subject: Re: custom-link vs custom-button face
Date: Sun, 22 Jan 2006 02:54:07 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

> When "See also ..." and "Parent documentation" links don't reference a
> manual they are displayed with `custom-button' instead of `custom-link'
> face.  The tiny patch below should fix that.

There are more places where links leading to other customization buffers
are displayed as buttons: custom-browse-group-tag, custom-browse-variable-tag,
custom-browse-face-tag.  The patch below changes their parent widget
from `push-button' to `custom-group-link', and adds corresponding
`button-face' and `mouse-face' to the widget `custom-group-link'.
This makes unnecessary explicit adding of `button-face' and `mouse-face'
to every instance of the `custom-group-link' widget.  Also there is
a special customization widget for info links, so the patch replaces
`info-link' with `custom-manual' which makes unnecessary adding of
`button-face' and `mouse-face' as well.

I also noticed that a new face `custom-link' was recently added
to cus-edit.el.  Currently it is a copy of `info-xref' and it
even retains its docstring and the group name `:group 'info'.
This is wrong.  I've added a new face `link' to share for `custom-link',
`info-xref', and perhaps more faces could inherit from it.

Also the face `custom-button-unraised' uses the copy of `info-xref'.
But instead of inheriting from the new face `link', I think it's
better to use underline to distinguish unraised buttons from links.
The following patch also removes square brackets from links even
in customization buffers with unraised buttons, because the link face
makes square brackets unnecessary for links.

Index: lisp/cus-edit.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/cus-edit.el,v
retrieving revision 1.279
diff -c -r1.279 cus-edit.el
*** lisp/cus-edit.el    19 Jan 2006 23:26:04 -0000      1.279
--- lisp/cus-edit.el    22 Jan 2006 00:47:55 -0000
***************
*** 1470,1487 ****
                               (if custom-raised-buttons
                                   "`Raised' text indicates"
                                 "Square brackets indicate")))
!       (widget-create 'info-link
                       :tag "Custom file"
-                      :button-face 'custom-link
-                      :mouse-face 'highlight
                       "(emacs)Saving Customizations")
        (widget-insert
         " for information on how to save in a different file.\n
  See ")
!       (widget-create 'info-link
                       :tag "Help"
-                      :button-face 'custom-link
-                      :mouse-face 'highlight
                       :help-echo "Read the online help."
                       "(emacs)Easy Customization")
        (widget-insert " for more information.\n\n")
--- 1470,1483 ----
                               (if custom-raised-buttons
                                   "`Raised' text indicates"
                                 "Square brackets indicate")))
!       (widget-create 'custom-manual
                       :tag "Custom file"
                       "(emacs)Saving Customizations")
        (widget-insert
         " for information on how to save in a different file.\n
  See ")
!       (widget-create 'custom-manual
                       :tag "Help"
                       :help-echo "Read the online help."
                       "(emacs)Easy Customization")
        (widget-insert " for more information.\n\n")
***************
*** 1497,1506 ****
    (if (not custom-buffer-verbose-help)
        (progn
        (widget-insert " ")
!       (widget-create 'info-link
                       :tag "Help"
-                      :button-face 'custom-link
-                      :mouse-face 'highlight
                       :help-echo "Read the online help."
                       "(emacs)Easy Customization")))
    (when (or custom-file user-init-file)
--- 1493,1500 ----
    (if (not custom-buffer-verbose-help)
        (progn
        (widget-insert " ")
!       (widget-create 'custom-manual
                       :tag "Help"
                       :help-echo "Read the online help."
                       "(emacs)Easy Customization")))
    (when (or custom-file user-init-file)
***************
*** 1648,1654 ****
    (let ((custom-buffer-style 'tree))
      (custom-toggle-parent widget)))
  
! (define-widget 'custom-browse-group-tag 'push-button
    "Show parent in other window when activated."
    :tag "Group"
    :tag-glyph "folder"
--- 1642,1648 ----
    (let ((custom-buffer-style 'tree))
      (custom-toggle-parent widget)))
  
! (define-widget 'custom-browse-group-tag 'custom-group-link
    "Show parent in other window when activated."
    :tag "Group"
    :tag-glyph "folder"
***************
*** 1658,1664 ****
    (let ((parent (widget-get widget :parent)))
      (customize-group-other-window (widget-value parent))))
  
! (define-widget 'custom-browse-variable-tag 'push-button
    "Show parent in other window when activated."
    :tag "Option"
    :tag-glyph "option"
--- 1652,1658 ----
    (let ((parent (widget-get widget :parent)))
      (customize-group-other-window (widget-value parent))))
  
! (define-widget 'custom-browse-variable-tag 'custom-group-link
    "Show parent in other window when activated."
    :tag "Option"
    :tag-glyph "option"
***************
*** 1668,1674 ****
    (let ((parent (widget-get widget :parent)))
      (customize-variable-other-window (widget-value parent))))
  
! (define-widget 'custom-browse-face-tag 'push-button
    "Show parent in other window when activated."
    :tag "Face"
    :tag-glyph "face"
--- 1662,1668 ----
    (let ((parent (widget-get widget :parent)))
      (customize-variable-other-window (widget-value parent))))
  
! (define-widget 'custom-browse-face-tag 'custom-group-link
    "Show parent in other window when activated."
    :tag "Face"
    :tag-glyph "face"
***************
*** 2010,2022 ****
    :group 'custom-faces)
  
  (defface custom-button-unraised
!   '((((min-colors 88)
!       (class color) (background light)) :foreground "blue1" :underline t)
!     (((class color) (background light)) :foreground "blue" :underline t)
!     (((min-colors 88)
!       (class color) (background dark)) :foreground "cyan1" :underline t)
!     (((class color) (background dark)) :foreground "cyan" :underline t)
!     (t :underline t))
    "Face for custom buffer buttons if `custom-raised-buttons' is nil."
    :version "22.1"
    :group 'custom-faces)
--- 2004,2010 ----
    :group 'custom-faces)
  
  (defface custom-button-unraised
!   '((t :inherit underline))
    "Face for custom buffer buttons if `custom-raised-buttons' is nil."
    :version "22.1"
    :group 'custom-faces)
***************
*** 2071,2085 ****
  (put 'custom-state-face 'face-alias 'custom-state)
  
  (defface custom-link
!   '((((min-colors 88)
!       (class color) (background light)) :foreground "blue1" :underline t)
!     (((class color) (background light)) :foreground "blue" :underline t)
!     (((min-colors 88)
!       (class color) (background dark)) :foreground "cyan1" :underline t)
!     (((class color) (background dark)) :foreground "cyan" :underline t)
!     (t :underline t))
!   "Face for Info links in customization buffers."
!   :group 'info)
  
  (define-widget 'custom 'default
    "Customize a user option."
--- 2059,2068 ----
  (put 'custom-state-face 'face-alias 'custom-state)
  
  (defface custom-link
!   '((t :inherit link))
!   "Face for links in customization buffers."
!   :version "22.1"
!   :group 'custom-faces)
  
  (define-widget 'custom 'default
    "Customize a user option."
***************
*** 2246,2253 ****
                  (insert " ")
                  (push (widget-create-child-and-convert
                         widget 'custom-group-link
-                        :button-face 'custom-link
-                        :mouse-face 'highlight
                         :tag (custom-unlispify-tag-name symbol)
                         symbol)
                        buttons)
--- 2229,2234 ----
***************
*** 3607,3612 ****
--- 3588,3595 ----
  
  (define-widget 'custom-group-link 'link
    "Show parent in other window when activated."
+   :button-face 'custom-link
+   :mouse-face 'highlight
    :help-echo "Create customization buffer for this group."
    :action 'custom-group-link-action)
  
***************
*** 3805,3812 ****
           (if (eq custom-buffer-style 'links)
               (push (widget-create-child-and-convert
                      widget 'custom-group-link
-                     :button-face 'custom-link
-                     :mouse-face 'highlight
                      :tag "Go to Group"
                      symbol)
                     buttons)
--- 3789,3794 ----
***************
*** 4459,4467 ****
    ;; may not be optimal.
    (when custom-raised-buttons
      (set (make-local-variable 'widget-push-button-prefix) "")
!     (set (make-local-variable 'widget-push-button-suffix) "")
!     (set (make-local-variable 'widget-link-prefix) "")
!     (set (make-local-variable 'widget-link-suffix) ""))
    (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)
    (run-mode-hooks 'custom-mode-hook))
  
--- 4451,4459 ----
    ;; may not be optimal.
    (when custom-raised-buttons
      (set (make-local-variable 'widget-push-button-prefix) "")
!     (set (make-local-variable 'widget-push-button-suffix) ""))
!   (set (make-local-variable 'widget-link-prefix) "")
!   (set (make-local-variable 'widget-link-suffix) "")
    (add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)
    (run-mode-hooks 'custom-mode-hook))
  
Index: lisp/faces.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/faces.el,v
retrieving revision 1.346
diff -c -r1.346 faces.el
*** lisp/faces.el       16 Jan 2006 23:45:34 -0000      1.346
--- lisp/faces.el       22 Jan 2006 00:44:55 -0000
***************
*** 1917,1922 ****
--- 1917,1944 ----
    :group 'basic-faces
    :version "22.1")
  
+ (defface link
+   '((((class color) (min-colors 88) (background light))
+      :foreground "blue1" :underline t)
+     (((class color) (background light))
+      :foreground "blue" :underline t)
+     (((class color) (min-colors 88) (background dark))
+      :foreground "cyan1" :underline t)
+     (((class color) (background dark))
+      :foreground "cyan" :underline t)
+     (t :inherit underline))
+   "Basic face for unvisited links."
+   :group 'basic-faces
+   :version "22.1")
+ 
+ (defface link-visited
+   '((default :inherit link)
+     (((class color) (background light)) :foreground "magenta4")
+     (((class color) (background dark)) :foreground "violet"))
+   "Basic face for visited links."
+   :group 'basic-faces
+   :version "22.1")
+ 
  (defface highlight
    '((((class color) (min-colors 88) (background light))
       :background "darkseagreen2")

Index: lisp/info.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/info.el,v
retrieving revision 1.472
diff -c -r1.472 info.el
*** lisp/info.el        17 Jan 2006 02:07:44 -0000      1.472
--- lisp/info.el        22 Jan 2006 00:44:57 -0000
***************
*** 129,148 ****
  (put 'info-menu-5 'face-alias 'info-menu-star)
  
  (defface info-xref
!   '((((min-colors 88)
!       (class color) (background light)) :foreground "blue1" :underline t)
!     (((class color) (background light)) :foreground "blue" :underline t)
!     (((min-colors 88)
!       (class color) (background dark)) :foreground "cyan1" :underline t)
!     (((class color) (background dark)) :foreground "cyan" :underline t)
!     (t :underline t))
!   "Face for Info cross-references."
    :group 'info)
  
  (defface info-xref-visited
!   '((default :inherit info-xref)
!     (((class color) (background light)) :foreground "magenta4")
!     (((class color) (background dark)) :foreground "violet"))
    "Face for visited Info cross-references."
    :group 'info)
  
--- 129,140 ----
  (put 'info-menu-5 'face-alias 'info-menu-star)
  
  (defface info-xref
!   '((t :inherit link))
!   "Face for unvisited Info cross-references."
    :group 'info)
  
  (defface info-xref-visited
!   '((t :inherit link-visited))
    "Face for visited Info cross-references."
    :group 'info)

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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