[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 5065698: Move the ‘declare’ form before the interactive spec
From: |
Juri Linkov |
Subject: |
Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions. |
Date: |
Sat, 23 Jan 2021 20:56:35 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>>>> (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
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., (continued)
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Dmitry Gutov, 2021/01/20
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Juri Linkov, 2021/01/20
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Juri Linkov, 2021/01/21
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Stefan Monnier, 2021/01/21
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Juri Linkov, 2021/01/21
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Stefan Monnier, 2021/01/21
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Juri Linkov, 2021/01/22
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Stefan Monnier, 2021/01/22
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Juri Linkov, 2021/01/23
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Stefan Monnier, 2021/01/23
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions.,
Juri Linkov <=
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Stefan Monnier, 2021/01/23
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Juri Linkov, 2021/01/23
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Stefan Monnier, 2021/01/23
- Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Stefan Monnier, 2021/01/23
Re: master 5065698: Move the ‘declare’ form before the interactive spec in 10 functions., Juri Linkov, 2021/01/20