Function: semantic-grammar-eldoc-get-macro-docstring

semantic-grammar-eldoc-get-macro-docstring is a byte-compiled function defined in grammar.el.gz.

Signature

(semantic-grammar-eldoc-get-macro-docstring MACRO EXPANDER)

Documentation

Return a one-line docstring for the given grammar MACRO.

EXPANDER is the name of the function that expands MACRO.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/grammar.el.gz
(defun semantic-grammar-eldoc-get-macro-docstring (macro expander)
  "Return a one-line docstring for the given grammar MACRO.
EXPANDER is the name of the function that expands MACRO."
  (require 'eldoc)
  (cond
   ((eq expander (car semantic-grammar-eldoc-last-data))
    (cdr semantic-grammar-eldoc-last-data))
   ((fboundp 'eldoc-function-argstring) ;; Emacs<25
    (let* ((doc (help-split-fundoc (documentation expander t) expander)))
      (cond
       (doc
        (setq doc (car doc))
        (string-match "\\`[^ )]* ?" doc)
        (setq doc (concat "(" (substring doc (match-end 0)))))
       (t
        (setq doc (eldoc-function-argstring expander))))
      (when doc
        (setq doc
	      (semantic--docstring-format-sym-doc
	       macro (format "==> %s %s" expander doc) 'default))
        (setq semantic-grammar-eldoc-last-data (cons expander doc)))
      doc))
   ((fboundp 'elisp-get-fnsym-args-string) ;; Emacs≥25
    (concat (propertize (symbol-name macro)
                         'face 'font-lock-keyword-face)
             " ==> "
             (propertize (symbol-name macro)
                         'face 'font-lock-function-name-face)
             ": "
             (elisp-get-fnsym-args-string expander nil )))))