(symbol-file): Remove unused variable `functions'.
[bpt/emacs.git] / lisp / button.el
index c9f2cc4..17460fc 100644 (file)
@@ -1,4 +1,4 @@
-;;; button.el --- Clickable buttons
+;;; button.el --- clickable buttons
 ;;
 ;; Copyright (C) 2001 Free Software Foundation, Inc.
 ;;
@@ -50,7 +50,9 @@
 \f
 ;; Globals
 
-(defface button '((t :underline t))
+(defface button '((((type pc) (class color))
+                  (:foreground "lightblue"))
+                 (t :underline t))
   "Default face used for buttons.")
 
 ;;;###autoload
@@ -113,18 +115,18 @@ Buttons inherit them by setting their `category' property to that symbol."
 The remaining arguments form a sequence of PROPERTY VALUE pairs,
 specifying properties to use as defaults for buttons with this type
 \(a button's type may be set by giving it a `type' property when
-creating the button).
-
-The property `supertype' may be used to specify a button-type from which
-NAME inherits its default property values \(however, the inheritance
-happens only when NAME is defined; subsequent changes to a supertype are
-not reflected in its subtypes)."
-  (let* ((catsym (make-symbol (concat (symbol-name name) "-button")))
-        (supertype
+creating the button, using the :type keyword argument).
+
+In addition, the keyword argument :supertype may be used to specify a
+button-type from which NAME inherits its default property values
+\(however, the inheritance happens only when NAME is defined; subsequent
+changes to a supertype are not reflected in its subtypes)."
+  (let ((catsym (make-symbol (concat (symbol-name name) "-button")))
+       (super-catsym
+        (button-category-symbol
          (or (plist-get properties 'supertype)
-             (plist-get properties :supertype)))
-        (super-catsym
-         (if supertype (button-category-symbol supertype) 'default-button)))
+             (plist-get properties :supertype)
+             'button))))
     ;; Provide a link so that it's easy to find the real symbol.
     (put name 'button-category-symbol catsym)
     ;; Initialize NAME's properties using the global defaults.
@@ -140,6 +142,9 @@ not reflected in its subtypes)."
        (when (eq prop :supertype)
          (setq prop 'supertype))
        (put catsym prop (pop properties))))
+    ;; Make sure there's a `supertype' property
+    (unless (get catsym 'supertype)
+      (put catsym 'supertype 'button))
     name))
 
 (defun button-type-put (type prop val)
@@ -220,6 +225,7 @@ the normal action is used instead."
   (buffer-substring-no-properties (button-start button) (button-end button)))
 
 (defsubst button-type (button)
+  "Return BUTTON's button-type."
   (button-get button 'type))
 
 (defun button-has-type-p (button type)
@@ -233,9 +239,10 @@ the normal action is used instead."
 (defun make-button (beg end &rest properties)
   "Make a button from BEG to END in the current buffer.
 The remaining arguments form a sequence of PROPERTY VALUE pairs,
-specifying properties to add to the button.  In particular, the `type'
-property may be used to specify a button-type from which to inherit
-other properties; see `define-button-type'.
+specifying properties to add to the button.
+In addition, the keyword argument :type may be used to specify a
+button-type from which to inherit other properties; see
+`define-button-type'.
 
 Also see `make-text-button', `insert-button'."
   (let ((overlay (make-overlay beg end nil t nil)))
@@ -254,9 +261,10 @@ Also see `make-text-button', `insert-button'."
 (defun insert-button (label &rest properties)
   "Insert a button with the label LABEL.
 The remaining arguments form a sequence of PROPERTY VALUE pairs,
-specifying properties to add to the button.  In particular, the `type'
-property may be used to specify a button-type from which to inherit
-other properties; see `define-button-type'.
+specifying properties to add to the button.
+In addition, the keyword argument :type may be used to specify a
+button-type from which to inherit other properties; see
+`define-button-type'.
 
 Also see `insert-text-button', `make-button'."
   (apply #'make-button
@@ -271,9 +279,10 @@ Also see `insert-text-button', `make-button'."
 (defun make-text-button (beg end &rest properties)
   "Make a button from BEG to END in the current buffer.
 The remaining arguments form a sequence of PROPERTY VALUE pairs,
-specifying properties to add to the button.  In particular, the `type'
-property may be used to specify a button-type from which to inherit
-other properties; see `define-button-type'.
+specifying properties to add to the button.
+In addition, the keyword argument :type may be used to specify a
+button-type from which to inherit other properties; see
+`define-button-type'.
 
 This function is like `make-button', except that the button is actually
 part of the text instead of being a property of the buffer.  Creating
@@ -306,9 +315,10 @@ Also see `insert-text-button'."
 (defun insert-text-button (label &rest properties)
   "Insert a button with the label LABEL.
 The remaining arguments form a sequence of PROPERTY VALUE pairs,
-specifying properties to add to the button.  In particular, the `type'
-property may be used to specify a button-type from which to inherit
-other properties; see `define-button-type'.
+specifying properties to add to the button.
+In addition, the keyword argument :type may be used to specify a
+button-type from which to inherit other properties; see
+`define-button-type'.
 
 This function is like `insert-button', except that the button is
 actually part of the text instead of being a property of the buffer.