]> git.eshelyaron.com Git - emacs.git/commit
Warn about unwind-protect without unwind forms
authorMattias Engdegård <mattiase@acm.org>
Wed, 29 Mar 2023 11:21:26 +0000 (13:21 +0200)
committerMattias Engdegård <mattiase@acm.org>
Wed, 29 Mar 2023 17:47:03 +0000 (19:47 +0200)
commit9c31ee468618c95959454736d939eb46bc52b19b
treea8ce7a49681f33cb4dabc0e0d60d6bb6a8bd36b9
parent7177393826c73c87ffe9b428f0e5edae244d7a98
Warn about unwind-protect without unwind forms

`unwind-protect` without unwind forms is not just pointless but often
indicates a mistake where the intended unwind part is misplaced, as in

    (unwind-protect (progn PROT-FORMS UNWIND-FORMS))   ; oops

or

    (unwind-protect PROT-FORM) UNWIND-FORMS            ; also oops

or entirely forgotten for that matter.  Warning about this makes
sense, and the warning can always be silenced by removing the
`unwind-protect` altogether if it shouldn't be there in the first
place.

* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Implement
warning.
* etc/NEWS: Announce.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-test--with-suppressed-warnings): Add test case.
etc/NEWS
lisp/emacs-lisp/macroexp.el
test/lisp/emacs-lisp/bytecomp-tests.el