unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions.
Date: Sat, 23 Jan 2021 20:56:35 +0200	[thread overview]
Message-ID: <87h7n78ot8.fsf@mail.linkov.net> (raw)
In-Reply-To: <jwvbldfr0tq.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 23 Jan 2021 13:01:29 -0500")

>>>>   (let ((warnfun (lambda ()
>>>>                    (message "Warning: Unknown defun property `%S' in %S"
>>>>                             (car x) name))))
>>>>     `(progn
>>>>        (macroexp--funcall-if-compiled ',warnfun)))
>>>
>>> How did you try it?
>>
>> Compiled this, then tried to byte-compile a file with wrong `declare`,
>> still same warning without line numbers.
>
> Ah, well, you used `message` so you got what you deserved ;-)
> If you look at `macroexp--warn-and-return` it uses `byte-compile-warn`.
> BTW, did you you use `macroexp--funcall-if-compiled` instead of
> `macroexp--warn-and-return` because of bootstrapping concerns?

Because I don't know what to give to the second arg FORM of
'macroexp--warn-and-return'.  I tried to use 'name' for FORM,
but then it prints some irrelevant warning:

  mh-e/mh-speed.el:161:25: Warning: reference to free variable `mh-speed-toggle'

But with this patch that uses `byte-compile-warn`:

diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 0f8dd5a284..bf9f3f3fbc 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -301,8 +301,12 @@ defun
                                 (cdr body)
                               body)))
                     nil)
-                   (t (message "Warning: Unknown defun property `%S' in %S"
-                               (car x) name)))))
+                   (t (let ((warnfun (lambda ()
+                                       (byte-compile-warn
+                                        "Unknown defun property `%S' in %S"
+                                        (car x) name))))
+                        `(progn
+                           (macroexp--funcall-if-compiled ',warnfun)))))))
                    decls))
           (def (list 'defalias
                      (list 'quote name)

these warnings finally look right:

    ELC      mh-e/mh-speed.elc
  In toplevel form:
  mh-e/mh-speed.el:161:25: Warning: Unknown defun property `ignore' in
      mh-speed-toggle
  mh-e/mh-speed.el:179:9: Warning: Unknown defun property `ignore' in
      mh-speed-view



  reply	other threads:[~2021-01-23 18:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210120191935.5488.54008@vcs0.savannah.gnu.org>
     [not found] ` <20210120191936.DCB55209AB@vcs0.savannah.gnu.org>
2021-01-20 21:02   ` master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions Stefan Monnier
2021-01-20 21:36     ` Juri Linkov
2021-01-20 21:03   ` Lars Ingebrigtsen
2021-01-20 21:35     ` Juri Linkov
2021-01-20 21:50       ` Juri Linkov
2021-01-20 22:00         ` Dmitry Gutov
2021-01-20 22:19           ` Juri Linkov
2021-01-21 21:52             ` Juri Linkov
2021-01-21 22:01               ` Stefan Monnier
2021-01-21 22:32                 ` Juri Linkov
2021-01-22  0:22                   ` Stefan Monnier
2021-01-22  8:50                     ` Juri Linkov
2021-01-22 14:04                       ` Stefan Monnier
2021-01-23 17:33                         ` Juri Linkov
2021-01-23 18:01                           ` Stefan Monnier
2021-01-23 18:56                             ` Juri Linkov [this message]
2021-01-23 19:57                               ` Stefan Monnier
2021-01-23 20:14                                 ` Juri Linkov
2021-01-23 20:49                                   ` Stefan Monnier
2021-01-23 21:05                                   ` Stefan Monnier
2021-01-20 21:58     ` Juri Linkov
2021-01-20 22:09       ` Lars Ingebrigtsen
2021-01-22  2:13         ` Mike Kupfer
2021-01-22 18:22           ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7n78ot8.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).