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

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

Re: incorrect warning when byte compiling?


From: John Wiegley
Subject: Re: incorrect warning when byte compiling?
Date: Mon, 25 Jun 2012 02:20:17 -0500
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1 (darwin)

>>>>> Richard Hansen <rhansen@bbn.com> writes:

> Yes, whitespace-mode can be undefined at runtime, but only if the whitespace
> feature isn't available.  If whitespace is NOT available, the body of the
> when' will not execute, so it won't try to execute the undefined
> whitespace-mode function.  If whitespace IS available, whitespace-mode is
> guaranteed to be defined.  Either way, there's no way Emacs will try to
> execute an undefined whitespace-mode function.

The byte-compiler doesn't do as much code-flow analysis as you're expecting
here.  Since the call to `require' is inside a function definition, it doesn't
actually need to invoke the `require' to byte-compile the function.  So it
doesn't know if the function is going to get pulled in by the require or not.

You can try moving your require outside the function.

> Is this a bug/limitation in the Emacs byte compiler?  Or is there a subtle
> bug in my code?

> It's easy enough to silence this warning (e.g., with (when (fboundp
> whitespace-mode) ...)), but I want to know why Emacs thinks this is a
> problem.

A better way to wrap the code with:

    (with-no-warnings ...)

John


reply via email to

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