From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.bugs Subject: bug#27229: eldoc wrong highlighting for "when" Date: Fri, 03 Sep 2021 15:20:07 +0100 Message-ID: <86lf4dwxk8.fsf@gmail.com> References: <87k0w6dg58.fsf@web.de> <87o89a12nc.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14037"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) To: 27229@debbugs.gnu.org Cancel-Lock: sha1:cOefVOz99serNbV4fglIzs32ga0= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 03 16:21:38 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mMA4X-0003Rf-Ew for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Sep 2021 16:21:37 +0200 Original-Received: from localhost ([::1]:47874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMA4W-0000NM-2i for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 03 Sep 2021 10:21:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMA3z-0008WT-2l for bug-gnu-emacs@gnu.org; Fri, 03 Sep 2021 10:21:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34114) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMA3y-0004Ki-M9 for bug-gnu-emacs@gnu.org; Fri, 03 Sep 2021 10:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mMA3y-0003Wz-Fl for bug-gnu-emacs@gnu.org; Fri, 03 Sep 2021 10:21:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Sep 2021 14:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27229 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo confirmed X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.163067882813503 (code B ref -1); Fri, 03 Sep 2021 14:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Sep 2021 14:20:28 +0000 Original-Received: from localhost ([127.0.0.1]:45660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMA3P-0003Vj-T6 for submit@debbugs.gnu.org; Fri, 03 Sep 2021 10:20:28 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:49148) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMA3O-0003Vc-II for submit@debbugs.gnu.org; Fri, 03 Sep 2021 10:20:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMA3M-0007IQ-IM for bug-gnu-emacs@gnu.org; Fri, 03 Sep 2021 10:20:26 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:44938) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMA3J-0003o2-DD for bug-gnu-emacs@gnu.org; Fri, 03 Sep 2021 10:20:23 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mMA3D-0001jv-LN for bug-gnu-emacs@gnu.org; Fri, 03 Sep 2021 16:20:15 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=geb-bug-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:213364 Archived-At: On Fri 03 Sep 2021, Lars Ingebrigtsen wrote: > Michael Heerdegen 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 > 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