Function: help-do-arg-highlight

help-do-arg-highlight is a byte-compiled function defined in help-fns.el.gz.

Signature

(help-do-arg-highlight DOC ARGS &optional USAGE-P)

Source Code

;; Defined in /usr/src/emacs/lisp/help-fns.el.gz
(defun help-do-arg-highlight (doc args &optional usage-p)
  (with-syntax-table (make-syntax-table emacs-lisp-mode-syntax-table)
    (modify-syntax-entry ?\- "w")
    (dolist (arg args)
      (setq doc (replace-regexp-in-string
                 ;; This is heuristic, but covers all common cases
                 ;; except ARG1-ARG2
                 (concat (when usage-p
                           ;; Skip function name in usage string
                           ;; (Bug#65580).
                           "([^ ]+ .*")
                         "\\<"                   ; beginning of word
                         "\\(?:[a-z-]*-\\)?"     ; for xxx-ARG
                         "\\("
                         (regexp-quote arg)
                         "\\)"
                         "\\(?:es\\|s\\|th\\)?"  ; for ARGth, ARGs
                         "\\(?:-[a-z0-9-]+\\)?"  ; for ARG-xxx, ARG-n
                         "\\(?:-[{([<`\"‘].*?\\)?"; for ARG-{x}, (x), <x>, [x], `x', ‘x                         "\\>")                  ; end of word
                 (help-highlight-arg arg)
                 doc t t 1)))
    doc))