GNU bug report logs -
#27229
eldoc wrong highlighting for "when"
Previous Next
Reported by: "Charles A. Roelli" <charles <at> aurox.ch>
Date: Sun, 4 Jun 2017 10:21:01 UTC
Severity: minor
Tags: confirmed
Found in versions 25.2, 28.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #28 received at submit <at> debbugs.gnu.org (full text, mbox):
On Fri 03 Sep 2021, Lars Ingebrigtsen wrote:
> Michael Heerdegen <michael_heerdegen <at> web.de> 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.
>
> I wonder -- why is this defined like this, anyway?
>
> (defmacro when (cond &rest body)
> "If COND yields non-nil, do BODY, else return nil.
> When COND yields non-nil, eval BODY forms sequentially and return
> value of last one, or nil if there are none.
>
> \(fn COND BODY...)"
>
> (when COND &rest BODY)
>
> is the correct signature, isn't it? Removing the (fn ...) from the doc
> string makes eldoc do the correct thing.
>
> The commit message is helpful:
>
> commit 7f67eea000b0ba102dd86c2666041dc395137413
> Author: Kim F. Storm <storm <at> cua.dk>
> AuthorDate: Sun Mar 18 00:44:24 2007 +0000
>
> (when, unless): Doc fix.
>
> Anybody know what the point of the (fn...) here is?
Have a look at (info "(elisp) Function Documentation") which explains
this usage. Perhaps eldoc needs fixing to understand that idiom.
AndyM
This bug report was last modified 3 years and 76 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.