(require 'widget) (eval-when-compile (require 'wid-edit)) (defun widget-example () "Create the widgets from the Widget manual." (interactive) (switch-to-buffer "*Widget Example*") (kill-all-local-variables) (let ((inhibit-read-only t)) (erase-buffer)) (remove-overlays) (widget-insert "Move the mouse over the links below to trigger the highlighting.\n\n") (widget-insert "This one looks normal:\n\n") (widget-create 'link "with brackets, w/o newline") (widget-insert "\n\nThis one looks okay, except that preferably, the whole first line\n" "shouldn't be highlighted, only the text:\n\n") (widget-create 'link "with brackets, with newline\n") (widget-insert "\n\nThis one, which uses roughly the same parameters as are used in the\n" "recentf dialog, looks really strange because the first character on the\n" "next line is highlighted as well:\n\n") (widget-create 'link :button-suffix "" :button-prefix "" "w/o brackets, with newline\n") (widget-insert "A <- this character shouldn't be highlighted.") (widget-insert "\n\nThis one looks normal:\n\n") (widget-create 'link :button-suffix "" :button-prefix "" "w/o brackets, w/o newline") (widget-insert "\n\nThis one should look the same as the previous one, but it doesn't\n" "because it is followed by EOF instead of a newline:\n\n") (widget-create 'link :button-suffix "" :button-prefix "" "w/o brackets, w/o newline") (widget-setup)) (widget-example)