+ "Current item in or for `apropos-accumulator'.")
+
+\f
+;;; Button types used by apropos
+
+(define-button-type 'apropos-symbol
+ 'face apropos-symbol-face
+ 'help-echo "mouse-2, RET: Display more help on this symbol"
+ 'action #'apropos-symbol-button-display-help
+ 'skip t)
+
+(defun apropos-symbol-button-display-help (button)
+ "Display further help for the `apropos-symbol' button BUTTON."
+ (button-activate
+ (or (apropos-next-label-button (button-start button))
+ (error "There is nothing to follow for `%s'" (button-label button)))))
+
+(define-button-type 'apropos-function
+ 'apropos-label "Function"
+ 'action (lambda (button)
+ (describe-function (button-get button 'apropos-symbol)))
+ 'help-echo "mouse-2, RET: Display more help on this function")
+(define-button-type 'apropos-macro
+ 'apropos-label "Macro"
+ 'action (lambda (button)
+ (describe-function (button-get button 'apropos-symbol)))
+ 'help-echo "mouse-2, RET: Display more help on this macro")
+(define-button-type 'apropos-command
+ 'apropos-label "Command"
+ 'action (lambda (button)
+ (describe-function (button-get button 'apropos-symbol)))
+ 'help-echo "mouse-2, RET: Display more help on this command")
+
+;; We used to use `customize-variable-other-window' instead for a
+;; customizable variable, but that is slow. It is better to show an
+;; ordinary help buffer and let the user click on the customization
+;; button in that buffer, if he wants to.
+;; Likewise for `customize-face-other-window'.
+(define-button-type 'apropos-variable
+ 'apropos-label "Variable"
+ 'help-echo "mouse-2, RET: Display more help on this variable"
+ 'action (lambda (button)
+ (describe-variable (button-get button 'apropos-symbol))))
+
+(define-button-type 'apropos-face
+ 'apropos-label "Face"
+ 'help-echo "mouse-2, RET: Display more help on this face"
+ 'action (lambda (button)
+ (describe-face (button-get button 'apropos-symbol))))
+
+(define-button-type 'apropos-group
+ 'apropos-label "Group"
+ 'help-echo "mouse-2, RET: Display more help on this group"
+ 'action (lambda (button)
+ (customize-variable-other-window
+ (button-get button 'apropos-symbol))))
+
+(define-button-type 'apropos-widget
+ 'apropos-label "Widget"
+ 'help-echo "mouse-2, RET: Display more help on this widget"
+ 'action (lambda (button)
+ (widget-browse-other-window (button-get button 'apropos-symbol))))
+
+(define-button-type 'apropos-plist
+ 'apropos-label "Plist"
+ 'help-echo "mouse-2, RET: Display more help on this plist"
+ 'action (lambda (button)
+ (apropos-describe-plist (button-get button 'apropos-symbol))))
+
+(defun apropos-next-label-button (pos)
+ "Returns the next apropos label button after POS, or nil if there's none.
+Will also return nil if more than one `apropos-symbol' button is encountered
+before finding a label."
+ (let* ((button (next-button pos t))
+ (already-hit-symbol nil)
+ (label (and button (button-get button 'apropos-label)))
+ (type (and button (button-get button 'type))))
+ (while (and button
+ (not label)
+ (or (not (eq type 'apropos-symbol))
+ (not already-hit-symbol)))
+ (when (eq type 'apropos-symbol)
+ (setq already-hit-symbol t))
+ (setq button (next-button (button-start button)))
+ (when button
+ (setq label (button-get button 'apropos-label))
+ (setq type (button-get button 'type))))
+ (and label button)))
+