GNU bug report logs - #55905
warn about misplaced or duplicated doc strings, `declare` or `interactive` forms

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Sat, 11 Jun 2022 12:08:01 UTC

Severity: normal

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#55905: closed (warn about misplaced or duplicated doc
 strings, `declare` or `interactive` forms)
Date: Fri, 17 Jun 2022 15:31:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 17 Jun 2022 17:30:17 +0200
with message-id <F6605703-4C25-4BA5-A3B5-5FA19F532314 <at> acm.org>
and subject line Re: bug#55905: warn about misplaced or duplicated doc strings, `declare` or `interactive` forms
has caused the debbugs.gnu.org bug report #55905,
regarding warn about misplaced or duplicated doc strings, `declare` or `interactive` forms
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
55905: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55905
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: bug-gnu-emacs <at> gnu.org
Subject: warn about misplaced or duplicated doc strings, `declare` or
 `interactive` forms
Date: Sat, 11 Jun 2022 14:07:03 +0200
[Message part 3 (text/plain, inline)]
In function definitions, doc strings, `declare` and `interactive` forms are each optional but must appear in that order and duplications are not permitted. Many violations against these rules go undetected.

The attached patch adds checks to `defun` and `defmacro`. Violations result in compilation warnings but it could be changed into hard errors if desired. It also accepts `(:documentation EXPR)` as alternative to a doc string literal, which currently doesn't work i all cases.

Applying it reveals a handful of mistakes in the Emacs source tree, and in some external packages.

[0001-function-and-macro-attribute-order-warning-patch.patch (application/octet-stream, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55905-done <at> debbugs.gnu.org
Subject: Re: bug#55905: warn about misplaced or duplicated doc strings,
 `declare` or `interactive` forms
Date: Fri, 17 Jun 2022 17:30:17 +0200
11 juni 2022 kl. 14.44 skrev Lars Ingebrigtsen <larsi <at> gnus.org>:

> This is most welcome -- I can never remember myself what the order of
> declare and interactive is.

Same here (which prompted the patch). A slightly updated version has now been pushed to master.

There's the possibility of making the parsing more tolerant with respect to ordering, and possibly allow multiple `declare` forms. It would be easy enough.



This bug report was last modified 3 years ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.