See Info node `Font Lock' and Info node `(elisp)Font Lock Basics'.
@end smallexample
+To link to a customization group, write the single-quoted name of the
+group, preceded by @samp{customization group} (the first character in
+each word is case-insensitive). For example,
+
+@smallexample
+See the customization group `whitespace' for details.
+@end smallexample
+
Finally, to create a hyperlink to URLs, write the single-quoted URL,
preceded by @samp{URL}. For example,
\f
* Lisp Changes in Emacs 28.1
++++
+*** Doc strings can now link to customization groups.
+Text like "customization group 'whitespace'" will be made into a
+button. When clicked, it'll take the user to a Custom buffer
+displaying that customization group.
+
+++
*** New macro 'with-existing-directory'.
This macro binds 'default-directory' to some other existing directory
'help-function #'info
'help-echo (purecopy "mouse-2, RET: read this Info node"))
+(define-button-type 'help-customization-group
+ :supertype 'help-xref
+ 'help-function #'customize-group
+ 'help-echo (purecopy "mouse-2, RET: display this customization group"))
+
(define-button-type 'help-url
:supertype 'help-xref
'help-function #'browse-url
"\\<[Ii]nfo[ \t\n]+\\(node\\|anchor\\)[ \t\n]+['`‘]\\([^'’]+\\)['’]")
"Regexp matching doc string references to an Info node.")
+(defconst help-xref-customization-group-regexp
+ (purecopy "\\<[Cc]ustomization[ \t\n]+[Gg]roup[ \t\n]+['`‘]\\([^'’]+\\)['’]")
+ "Regexp matching doc string references to a customization group.")
+
(defconst help-xref-url-regexp
(purecopy "\\<[Uu][Rr][Ll][ \t\n]+['`‘]\\([^'’]+\\)['’]")
"Regexp matching doc string references to a URL.")
(setq data ;; possible newlines if para filled
(replace-regexp-in-string "[ \t\n]+" " " data t t)))
(help-xref-button 2 'help-info data))))
+ ;; Customization groups.
+ (save-excursion
+ (while (re-search-forward
+ help-xref-customization-group-regexp nil t)
+ (help-xref-button 1 'help-customization-group
+ (intern (match-string 1)))))
;; URLs
(save-excursion
(while (re-search-forward help-xref-url-regexp nil t)