Hello.
I've found some cases where ElDoc displays function information in
the echo area, when it shouldn't.
Try the following, with the attached test.el (no need to eval it):
1) emacs -Q
2) C-x C-f test.el
3) There are two 'and' in the doc string of foo. Do a search for 'and'
and stop after the first:
C-s and C-f: ElDoc doesn't show a function in the echo area, that's
fine.
Now search for the next 'and':
C-s C-s C-f: ElDoc shows `and: (CONDITIONS...)' in the echo area. That
shouldn't happen.
4) Also, there's a " in a comment, in the last line. Search for "here",
just like for "and" before:
C-s here C-f: ElDoc again shows `and: (CONDITIONS...)'. That again,
shouldn't happen.
In these cases, I see that elisp--fnsym-in-current-sexp doesn't return nil,
as it should when point is inside a string. So far, I've only found that
a quoted ( confuses it, when the ) is not quoted. But for the bug to
become visible, the word that follows ")" has to be an interned symbol.
Another example is in the file lisp/files.el. Put point in the doc string of
the variable file-name-version-regexp, and see that ElDoc shows
`while: (TEST BODY...)' in the echo area. I think that happens because
there are " in some comments lines before the doc string.
It seems that the problem is that elisp--beginning-of-sexp calls
forward-sexp, even though its doc string explicitly says that it assumes
point is not in a string or a comment. Most of the time it still works,
but it fails in some cases, and in those cases, the check for the current
word not being inside a string loses its purpose.
Perhaps using the return value of syntax-ppss before calling
elisp--beginning-of-sexp would be enough to avoid this confusion.
Also, let me ask: was there any discussion about the usefulness of having
ElDoc display information when point is inside a comment? I ask because
I only see the intention to check when not inside a string.
Best regards,
Mauro.