From: Yuta Yamada <sleepboy.zzz@gmail.com>
To: michael_heerdegen@web.de
Cc: 23495@debbugs.gnu.org
Subject: bug#23495: byte-compile-file return t when there is "XXX can't use lexical var" error
Date: Wed, 11 May 2016 07:33:59 -0700 (PDT) [thread overview]
Message-ID: <20160511.073359.1441885897227740593.sleepboy.zzz@gmail.com> (raw)
In-Reply-To: <87vb2k6c3w.fsf@web.de>
Michael Heerdegen <michael_heerdegen@web.de> writes:
> > 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'.
> I wonder if we could/should call `byte-compile-warn' instead.
I found this web page (sorry if you already knew):
https://www.gnu.org/software/emacs/manual/html_node/elisp/Warning-Basics.html
And it describes:
"If you want to take the trouble to implement a way to continue
processing despite the bad data, then reporting a warning of severity
:error is the right way to inform the user of the problem. For
instance, the Emacs Lisp byte compiler can report an error that way
and continue compiling other functions. (If the program signals a Lisp
error and then handles it with condition-case, the user won ’ t see the
error message; it could show the message to the user by reporting it
as a warning.)"
So, seems there is an intent about this warning.
> But Yuta, please tell me about your use case. A lot of other warnings
> printed while byte compiling can hint to similarly serious mistakes in
> the code.
> Would changing the behavior of this particular case really make things
> better? Can't you just have a look at the compiler warnings, which is a
> good idea (necessary) anyway?
When I write elisp code myself, current behavior is ok. I can see the
pseudo error (or warning) message from flycheck/flymake, but when I
review other people's elisp codes on GitHub, I'm using Travis to check
byte compile warnings or errors and if tests are passed, I expects
there is no byte compile errors and I normally don't check build
result. (I think other elisp package maintainers too.)
For example, this is a build result when I noticed this error:
https://travis-ci.org/nim-lang/nim-mode/jobs/126456294
There are many noises to check errors and warnings and I'm hoping
returning non-zero status code in this case, so I can reduce the
chance to see the build result. (even this is a warning,
"Error: ..." sentence made me imagine I got an error...)
I understood that treating this warning as error hides other byte
compile warnings, so how about adding extra code to
`byte-compile-log-warning` function or make new function for this type
of warning that emits "Error: ...." message, but actually it's a warning?
----
(defun byte-compile-log-warning (string &optional fill level)
(let ((warning-prefix-function 'byte-compile-warning-prefix)
(warning-type-format "")
(warning-fill-prefix (if fill " ")))
(display-warning 'bytecomp string level byte-compile-log-buffer)
;; I added below code
;; the `byte-compiler-error-flag' changes final result of
;; byte-compile-file.
(when (or byte-compile-error-on-warn (eq level :error))
(setq byte-compiler-error-flag t))))
----
Thanks
Yuta
next prev parent reply other threads:[~2016-05-11 14:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-09 8:12 bug#23495: byte-compile-file return t when there is "XXX can't use lexical var" error Yuta Yamada
2016-05-10 18:23 ` Michael Heerdegen
2016-05-10 23:45 ` Yuta Yamada
2016-05-11 0:29 ` Michael Heerdegen
2016-05-11 11:57 ` Michael Heerdegen
2016-05-11 14:33 ` Yuta Yamada [this message]
2016-05-11 16:25 ` Michael Heerdegen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160511.073359.1441885897227740593.sleepboy.zzz@gmail.com \
--to=sleepboy.zzz@gmail.com \
--cc=23495@debbugs.gnu.org \
--cc=michael_heerdegen@web.de \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.