summaryrefslogtreecommitdiff
path: root/lisp/button.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/button.el')
-rw-r--r--lisp/button.el59
1 files changed, 34 insertions, 25 deletions
diff --git a/lisp/button.el b/lisp/button.el
index 74dfb5d5419..dd5a71d116a 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -113,22 +113,24 @@ Mode-specific keymaps may want to use this as their parent keymap.")
;; [this is an internal function]
(defsubst button-category-symbol (type)
- "Return the symbol used by button-type TYPE to store properties.
+ "Return the symbol used by `button-type' TYPE to store properties.
Buttons inherit them by setting their `category' property to that symbol."
(or (get type 'button-category-symbol)
(error "Unknown button type `%s'" type)))
(defun define-button-type (name &rest properties)
"Define a `button type' called NAME (a symbol).
-The remaining arguments form a plist 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, using the :type keyword argument).
+The remaining PROPERTIES arguments form a plist 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, 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
+`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)."
+ (declare (indent defun))
(let ((catsym (make-symbol (concat (symbol-name name) "-button")))
(super-catsym
(button-category-symbol
@@ -156,15 +158,15 @@ changes to a supertype are not reflected in its subtypes)."
name))
(defun button-type-put (type prop val)
- "Set the button-type TYPE's PROP property to VAL."
+ "Set the `button-type' TYPE's PROP property to VAL."
(put (button-category-symbol type) prop val))
(defun button-type-get (type prop)
- "Get the property of button-type TYPE named PROP."
+ "Get the property of `button-type' TYPE named PROP."
(get (button-category-symbol type) prop))
(defun button-type-subtype-p (type supertype)
- "Return non-nil if button-type TYPE is a subtype of SUPERTYPE."
+ "Return non-nil if `button-type' TYPE is a subtype of SUPERTYPE."
(or (eq type supertype)
(and type
(button-type-subtype-p (button-type-get type 'supertype)
@@ -271,11 +273,11 @@ This function only works when BUTTON is in the current buffer."
(button-end button))))
(defsubst button-type (button)
- "Return BUTTON's button-type."
+ "Return BUTTON's `button-type'."
(button-get button 'type))
(defun button-has-type-p (button type)
- "Return non-nil if BUTTON has button-type TYPE, or one of its subtypes."
+ "Return non-nil if BUTTON has `button-type' TYPE, or one of its subtypes."
(button-type-subtype-p (button-get button 'type) type))
(defun button--area-button-p (b)
@@ -290,10 +292,10 @@ Such area buttons are used for buttons in the mode-line and header-line."
(defun make-button (beg end &rest properties)
"Make a button from BEG to END in the current buffer.
-The remaining arguments form a plist of PROPERTY VALUE pairs,
-specifying properties to add to the button.
+The remaining PROPERTIES arguments form a plist of PROPERTY VALUE
+pairs, 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
+`button-type' from which to inherit other properties; see
`define-button-type'.
Also see `make-text-button', `insert-button'."
@@ -314,7 +316,7 @@ Also see `make-text-button', `insert-button'."
The remaining arguments form a plist of PROPERTY VALUE pairs,
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
+`button-type' from which to inherit other properties; see
`define-button-type'.
Also see `insert-text-button', `make-button'."
@@ -328,10 +330,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 plist of PROPERTY VALUE pairs,
-specifying properties to add to the button.
+The remaining PROPERTIES arguments form a plist of PROPERTY VALUE
+pairs, 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
+`button-type' from which to inherit other properties; see
`define-button-type'.
This function is like `make-button', except that the button is actually
@@ -382,10 +384,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 plist of PROPERTY VALUE pairs,
-specifying properties to add to the button.
+The remaining PROPERTIES arguments form a plist of PROPERTY VALUE
+pairs, 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
+`button-type' from which to inherit other properties; see
`define-button-type'.
This function is like `insert-button', except that the button is
@@ -602,7 +604,8 @@ When called from Lisp, pass BUTTON-OR-POS as the button to describe, or a
buffer position where a button is present. If BUTTON-OR-POS is nil, the
button at point is the button to describe."
(interactive "d")
- (let* ((button (cond ((integer-or-marker-p button-or-pos)
+ (let* ((help-buffer-under-preparation t)
+ (button (cond ((integer-or-marker-p button-or-pos)
(button-at button-or-pos))
((null button-or-pos) (button-at (point)))
((overlayp button-or-pos) button-or-pos)))
@@ -614,13 +617,19 @@ button at point is the button to describe."
(button--describe props)
t)))
-(defun button-buttonize (string callback &optional data)
+(define-obsolete-function-alias 'button-buttonize #'buttonize "29.1")
+
+(defun buttonize (string callback &optional data help-echo)
"Make STRING into a button and return it.
When clicked, CALLBACK will be called with the DATA as the
function argument. If DATA isn't present (or is nil), the button
-itself will be used instead as the function argument."
+itself will be used instead as the function argument.
+
+If HELP-ECHO, use that as the `help-echo' property."
(propertize string
'face 'button
+ 'mouse-face 'highlight
+ 'help-echo help-echo
'button t
'follow-link t
'category t