bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23495: byte-compile-file return t when there is "XXX can't use lexic


From: Michael Heerdegen
Subject: bug#23495: byte-compile-file return t when there is "XXX can't use lexical var" error
Date: Wed, 11 May 2016 02:29:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux)

Yuta Yamada <address@hidden> writes:

> Hi, I checked add-to-list fucntion in subr.el and I saw some fixme
> comments. Is this actually a warning? If so, should this warning
> return non zero status code when users specified `(setq
> byte-compile-error-on-warn t)`?

When there is a variable of the same in the dynamic scope, the
code will work.  So, a warning seems reasonable.


> I tried following command to compile:
>
> ----
> $ emacs -Q -batch --eval '(setq byte-compile-error-on-warn t)' -f
> batch-byte-compile ./foo.el
>
> In foo:
> foo.el:9:13:Error: `add-to-list' can't use lexical var `a'; use `push' or
>     `cl-pushnew'
> $ echo $?
> 0

> But, it returns 0. Is this desired behavior? or a bug?

Seems it's wanted.  The compiler calls `byte-compile-log-warning' in
this case, which, unlike `byte-compile-warn', circumvents
`byte-compile-error-on-warn'.

Someone with more knowledge about the byte compiler might want to
correct me.


I think you could get what you want by customizing `warning-levels',
like

(setcdr (cdr (assoc :error warning-levels))
        (list (lambda () (error "Error!"))))

or so.  I'm not sure if this is a good idea.



Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]