Example:
@lisp
+@group
(widget-create 'url-link
:button-prefix ""
:button-suffix ""
;; And then call the original function.
(widget-url-link-action widget))
"https://www.gnu.org/software/emacs/manual/html_mono/widget.html")
+@end group
@end lisp
@node info-link
Example:
@lisp
+@group
(widget-insert "Press the button to activate/deactivate the field: ")
(widget-create 'toggle
:notify (lambda (widget &rest _ignored)
:activate
:deactivate))))
(widget-insert "\n")
+@end group
+@group
(setq widget-example-field
(widget-create 'editable-field
:deactivate (lambda (widget)
(widget-field-start widget)
(widget-get widget :to)))))
(widget-apply widget-example-field :deactivate)))
+@end group
@end lisp
Example:
@lisp
+@group
(defvar widget-ranged-integer-map
(let ((map (copy-keymap widget-keymap)))
(define-key map [up] #'widget-ranged-integer-increase)
(define-key map [down] #'widget-ranged-integer-decrease)
map))
+@end group
+@group
(define-widget 'ranged-integer 'integer
"A ranged integer widget."
:min-value most-negative-fixnum
:max-value most-positive-fixnum
:keymap widget-ranged-integer-map)
+@end group
+@group
(defun widget-ranged-integer-change (widget how)
"Change the value of the ranged-integer WIDGET, according to HOW."
(let* ((value (widget-value widget))
(t (error "HOW has a bad value"))))
(inhibit-read-only t))
(widget-value-set widget newval)))
+@end group
+@group
(defun widget-ranged-integer-increase (widget)
"Increase the value of the ranged-integer WIDGET."
(interactive (list (widget-at)))
(widget-ranged-integer-change widget 'up))
+@end group
+@group
(defun widget-ranged-integer-decrease (widget)
"Decrease the value of the ranged-integer WIDGET."
(interactive (list (widget-at)))
(widget-ranged-integer-change widget 'down))
+@end group
@end lisp
@node Inspecting Widgets