Subject: Re: bug#27229: eldoc wrong highlighting for "when"

From: Michael Heerdegen <[email-masked]>
Date: Sun, 04 Oct 2020 01:49:23 +0200

Stefan Kangas <[email-masked]> writes:

> "Charles A. Roelli" <[email-masked]> writes:
>
> > From emacs -q, type "(when x y z": COND is highlighted
> > instead of BODY.  This is a regression from the behavior
> > of 24.5 (with eldoc-mode on).
>
> I can reproduce this on current master.

Seems this code is the culprit (`elisp--highlight-function-argument'):

| ;; Back to index 0 in ARG1 ARG2 ARG2 ARG3 etc...
| ;; like in `setq'.
| ((or (and (string-match-p "\\.\\.\\.\\'" argument)
|           (string= argument (car (last args-lst))))
|      (and (string-match-p "\\.\\.\\.\\'"
|                           (substring args 1 (1- (length args))))
|           (= (length (remove "..." args-lst)) 2)
|           (> index 1) (eq (logand index 1) 1)))
|  (setq index 0))

In general, the problem is that "..." can have different meanings (it's
not clear which arguments have to be repeated), so this is not trivial
to fix I think.

Michael.