1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-08 23:40:24 -08:00

(eldoc-get-fnsym-args-string): Make second argument optional, for

backwards compatibility, and only highlight args when present.
Fix symbol name typo (doc/args).
This commit is contained in:
Glenn Morris 2007-08-08 08:14:03 +00:00
parent a3fcbf6c3b
commit 4b4a23c466

View file

@ -267,13 +267,13 @@ Emacs Lisp mode) that support Eldoc.")
;; Return a string containing the function parameter list, or 1-line ;; Return a string containing the function parameter list, or 1-line
;; docstring if function is a subr and no arglist is obtainable from the ;; docstring if function is a subr and no arglist is obtainable from the
;; docstring or elsewhere. ;; docstring or elsewhere.
(defun eldoc-get-fnsym-args-string (sym argument-index) (defun eldoc-get-fnsym-args-string (sym &optional argument-index)
(let ((args nil) (let ((args nil)
(doc nil)) (doc nil))
(cond ((not (and sym (symbolp sym) (fboundp sym)))) (cond ((not (and sym (symbolp sym) (fboundp sym))))
((and (eq sym (aref eldoc-last-data 0)) ((and (eq sym (aref eldoc-last-data 0))
(eq 'function (aref eldoc-last-data 2))) (eq 'function (aref eldoc-last-data 2)))
(setq args (aref eldoc-last-data 1))) (setq doc (aref eldoc-last-data 1)))
((setq doc (help-split-fundoc (documentation sym t) sym)) ((setq doc (help-split-fundoc (documentation sym t) sym))
(setq args (car doc)) (setq args (car doc))
(string-match "\\`[^ )]* ?" args) (string-match "\\`[^ )]* ?" args)
@ -281,8 +281,9 @@ Emacs Lisp mode) that support Eldoc.")
(eldoc-last-data-store sym args 'function)) (eldoc-last-data-store sym args 'function))
(t (t
(setq args (eldoc-function-argstring sym)))) (setq args (eldoc-function-argstring sym))))
(when args (and args
(setq doc (eldoc-highlight-function-argument sym args argument-index))) argument-index
(setq doc (eldoc-highlight-function-argument sym args argument-index)))
doc)) doc))
;; Highlight argument INDEX in ARGS list for SYM. ;; Highlight argument INDEX in ARGS list for SYM.