Commit ae0195c0 authored by Glenn Morris's avatar Glenn Morris
Browse files

(eldoc-get-fnsym-args-string): Doc fix.

(eldoc-highlight-function-argument): Add a doc string.  Tweak previous
change: no need for INDEX to be optional, just need to handle nil.
parent 1283140e
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
2007-08-18 Glenn Morris <rgm@gnu.org> 2007-08-18 Glenn Morris <rgm@gnu.org>
* emacs-lisp/eldoc.el (eldoc-get-fnsym-args-string): Convert * emacs-lisp/eldoc.el (eldoc-get-fnsym-args-string): Add doc
comment to basic doc string. Also apply eldoc-argument-case in string. Also apply eldoc-argument-case in the help-split-fundoc
the help-split-fundoc case. Adapt for changed behavior of case. Adapt for changed behavior of eldoc-function-argstring,
eldoc-function-argstring, eldoc-function-argstring-format, and eldoc-function-argstring-format, and
eldoc-highlight-function-argument. eldoc-highlight-function-argument.
(eldoc-highlight-function-argument): Make INDEX argument (eldoc-highlight-function-argument): Handle nil INDEX argument,
optional, just call eldoc-docstring-format-sym-doc if absent. just call eldoc-docstring-format-sym-doc in that case.
(eldoc-function-argstring): Change the behavior. Now it converts (eldoc-function-argstring): Change the behavior. Now it converts
an argument list to a string. an argument list to a string.
(eldoc-function-argstring-format): Change the behavior. Now it (eldoc-function-argstring-format): Change the behavior. Now it
......
...@@ -264,11 +264,15 @@ Emacs Lisp mode) that support Eldoc.") ...@@ -264,11 +264,15 @@ Emacs Lisp mode) that support Eldoc.")
;; so we need to be careful that errors aren't ignored. ;; so we need to be careful that errors aren't ignored.
(error (message "eldoc error: %s" err)))) (error (message "eldoc error: %s" err))))
;; FIXME improve doc-string. (defun eldoc-get-fnsym-args-string (sym &optional index)
(defun eldoc-get-fnsym-args-string (sym &optional argument-index)
"Return a string containing the parameter list of the function SYM. "Return a string containing the parameter list of the function SYM.
If SYM is a subr and no arglist is obtainable from the docstring If SYM is a subr and no arglist is obtainable from the docstring
or elsewhere, return a 1-line docstring." or elsewhere, return a 1-line docstring. Calls the functions
`eldoc-function-argstring-format' and
`eldoc-highlight-function-argument' to format the result. The
former calls `eldoc-argument-case'; the latter gives the
function name `font-lock-function-name-face', and optionally
highlights argument number INDEX. "
(let (args doc) (let (args doc)
(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))
...@@ -292,12 +296,11 @@ or elsewhere, return a 1-line docstring." ...@@ -292,12 +296,11 @@ or elsewhere, return a 1-line docstring."
;; Change case, highlight, truncate. ;; Change case, highlight, truncate.
(if args (if args
(eldoc-highlight-function-argument (eldoc-highlight-function-argument
;; FIXME apply word by word, ignore &optional, &rest. sym (eldoc-function-argstring-format args) index))))
sym (eldoc-function-argstring-format args) argument-index))))
;; Highlight argument INDEX in ARGS list for SYM. (defun eldoc-highlight-function-argument (sym args index)
;; In the absence of INDEX, just call eldoc-docstring-format-sym-doc. "Highlight argument INDEX in ARGS list for function SYM.
(defun eldoc-highlight-function-argument (sym args &optional index) In the absence of INDEX, just call `eldoc-docstring-format-sym-doc'."
(let ((start nil) (let ((start nil)
(end 0) (end 0)
(argument-face 'bold)) (argument-face 'bold))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment