all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Wiegley <johnw@vulcan.local>
To: help-gnu-emacs@gnu.org
Subject: Re: incorrect warning when byte compiling?
Date: Mon, 25 Jun 2012 02:20:17 -0500	[thread overview]
Message-ID: <m2txxzhn7y.fsf@vulcan.local.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: mailman.3395.1340564211.855.help-gnu-emacs@gnu.org

>>>>> 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	other threads:[~2012-06-25  7:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3395.1340564211.855.help-gnu-emacs@gnu.org>
2012-06-25  7:20 ` John Wiegley [this message]
2012-06-25 22:55 ` incorrect warning when byte compiling? Stefan Monnier
2012-06-24 18:54 Richard Hansen

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=m2txxzhn7y.fsf@vulcan.local.i-did-not-set--mail-host-address--so-tickle-me \
    --to=johnw@vulcan.local \
    --cc=help-gnu-emacs@gnu.org \
    /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.