comparison lisp/emacs-lisp/eldoc.el @ 82329:694f889fbd90

(eldoc-get-fnsym-args-string): Make second argument optional, for backwards compatibility, and only highlight args when present. Fix symbol name typo (doc/args).
author Glenn Morris <rgm@gnu.org>
date Wed, 08 Aug 2007 08:14:03 +0000
parents b98604865ea0
children 943f0b2ad6bb 424b655804ca
comparison
equal deleted inserted replaced
82328:6187a43977b4 82329:694f889fbd90
265 (error (message "eldoc error: %s" err)))) 265 (error (message "eldoc error: %s" err))))
266 266
267 ;; Return a string containing the function parameter list, or 1-line 267 ;; Return a string containing the function parameter list, or 1-line
268 ;; docstring if function is a subr and no arglist is obtainable from the 268 ;; docstring if function is a subr and no arglist is obtainable from the
269 ;; docstring or elsewhere. 269 ;; docstring or elsewhere.
270 (defun eldoc-get-fnsym-args-string (sym argument-index) 270 (defun eldoc-get-fnsym-args-string (sym &optional argument-index)
271 (let ((args nil) 271 (let ((args nil)
272 (doc nil)) 272 (doc nil))
273 (cond ((not (and sym (symbolp sym) (fboundp sym)))) 273 (cond ((not (and sym (symbolp sym) (fboundp sym))))
274 ((and (eq sym (aref eldoc-last-data 0)) 274 ((and (eq sym (aref eldoc-last-data 0))
275 (eq 'function (aref eldoc-last-data 2))) 275 (eq 'function (aref eldoc-last-data 2)))
276 (setq args (aref eldoc-last-data 1))) 276 (setq doc (aref eldoc-last-data 1)))
277 ((setq doc (help-split-fundoc (documentation sym t) sym)) 277 ((setq doc (help-split-fundoc (documentation sym t) sym))
278 (setq args (car doc)) 278 (setq args (car doc))
279 (string-match "\\`[^ )]* ?" args) 279 (string-match "\\`[^ )]* ?" args)
280 (setq args (concat "(" (substring args (match-end 0)))) 280 (setq args (concat "(" (substring args (match-end 0))))
281 (eldoc-last-data-store sym args 'function)) 281 (eldoc-last-data-store sym args 'function))
282 (t 282 (t
283 (setq args (eldoc-function-argstring sym)))) 283 (setq args (eldoc-function-argstring sym))))
284 (when args 284 (and args
285 (setq doc (eldoc-highlight-function-argument sym args argument-index))) 285 argument-index
286 (setq doc (eldoc-highlight-function-argument sym args argument-index)))
286 doc)) 287 doc))
287 288
288 ;; Highlight argument INDEX in ARGS list for SYM. 289 ;; Highlight argument INDEX in ARGS list for SYM.
289 (defun eldoc-highlight-function-argument (sym args index) 290 (defun eldoc-highlight-function-argument (sym args index)
290 (let ((start nil) 291 (let ((start nil)