properties.
@end defun
+@defun button-buttonize string callback &optional data
+Sometimes it's more convenient to make a string into a button without
+inserting it into a buffer immediately, for instance when creating
+data structures that may then, later, be inserted into a buffer. This
+function makes @var{string} into such a string, and @var{callback}
+will be called when the user clicks on the button. The optional
+@var{data} parameter will be used as the parameter when @var{callback}
+is called. If @code{nil}, the button is used as the parameter instead.
+@end defun
+
@node Manipulating Buttons
@subsection Manipulating Buttons
@cindex manipulating buttons
*** New command 'diff-refresh-hunk'.
This new command (bound to 'C-c C-l') regenerates the current hunk.
+** Buttons
+
++++
+*** New minor mode 'button-mode'.
+This minor mode does nothing else than install 'button-buffer-map' as
+a minor mode map (which binds the 'TAB' / 'S-TAB' key bindings to navigate
+to buttons), and can be used in any view-mode-like buffer that has
+buttons in it.
+
++++
+*** New utility function 'button-buttonize'.
+This function takes a string and returns a string propertized in a way
+that makes it a valid button.
+
+
** Miscellaneous
---
This works like 'report-emacs-bug', but is more geared towards sending
patches to the Emacs issue tracker.
-+++
-*** New minor mode 'button-mode'.
-This minor mode does nothing else than install 'button-buffer-map' as
-a minor mode map (which binds the 'TAB' / 'S-TAB' key bindings to navigate
-to buttons), and can be used in any view-mode-like buffer that has
-buttons in it.
-
---
*** 'icomplete-show-matches-on-no-input' behavior change.
Previously, choosing a different completion with commands like 'C-.'
(button--describe props)
t)))
+(defun button-buttonize (string callback &optional data)
+ "Make STRING into a button and return it.
+When clicked, CALLBACK will be called with the optional DATA parameter."
+ (propertize string
+ 'face 'button
+ 'button t
+ 'follow-link t
+ 'category t
+ 'button-data data
+ 'keymap button-map
+ 'action callback))
+
(provide 'button)
;;; button.el ends here