Function: help-highlight-arguments
help-highlight-arguments is a byte-compiled function defined in
help-fns.el.gz.
Signature
(help-highlight-arguments USAGE DOC &rest ARGS)
Source Code
;; Defined in /usr/src/emacs/lisp/help-fns.el.gz
(defun help-highlight-arguments (usage doc &rest args)
(when (and usage (string-match "^(" usage))
(with-temp-buffer
(insert usage)
(goto-char (point-min))
(let ((case-fold-search nil)
(next (not (or args (looking-at "\\["))))
(opt nil))
;; Make a list of all arguments
(skip-chars-forward "^ ")
(while next
(or opt (not (looking-at " &")) (setq opt t))
(if (not (re-search-forward " \\([\\[(]*\\)\\([^] &).]+\\)" nil t))
(setq next nil)
(setq args (cons (match-string 2) args))
(when (and opt (string= (match-string 1) "("))
;; A pesky CL-style optional argument with default value,
;; so let's skip over it
(search-backward "(")
(goto-char (scan-sexps (point) 1)))))
;; Highlight arguments in the USAGE string
(setq usage (help-do-arg-highlight (buffer-string) args t))
;; Highlight arguments in the DOC string
(setq doc (and doc (help-do-arg-highlight doc args))))))
;; Return value is like the one from help-split-fundoc, but highlighted
(cons usage doc))