Subject: bug#18971: 25.0.50; incorrect warning from byte compiler

From: Tom Tromey <[email-masked]>
Date: Thu, 06 Nov 2014 08:46:40 -0700

>>>>> "Stefan" == Stefan Monnier <[email-masked]> writes:

>> ; -*- lexical-binding:t -*-
>> (require 'bytecomp)
>> (defun z ()
>> (byte-compile-close-variables
>> (message "hi")))

Stefan> If it hurts, don't do that.

Stefan> `byte-compile-close-variables' is an internal macro in bytecomp.el.
Stefan> Why do you need to use it elsewhere?

I want to be able to call byte-optimize-form and was under the
impression that byte-compile-close-variables was needed.  I'm doing this
for a project I'm working on where it is convenient to let the byte
compiler code macroexpand a form and do some simple optimizations on it.

I guess I don't understand why this would not be a bug, though.
Or at least it perplexes me why this happens; my only theory is that
somehow the defvars aren't seen when byte-compiling my file.  I suppose
if I wanted to export a macro like this, I would need it to come with
special declarations for the variables?  Except I didn't see a way to do
that either.

Tom