Subject: Re: Byte-compile lexical-scoped elisp

From: Stefan Monnier <[email-masked]>
Date: Mon, 25 Feb 2013 11:06:54 -0500

> The steps to reproduce:
> 1. wget https://github.com/leoliu/ack-el/raw/master/ack.el
> 2. Emacs -q -l ack.el
> 3. M-x ack
> file-name-nondirectory: Symbol's value as variable is void: project-root

Indeed, the problem is that the dynamic binding of project-root is
created inside the `interactive' spec and that spec is not run in the
proper lexical environment (it is run in lexical mode, but in an empty
lexical environment).

> Could you help me understand what is wrong here?

A bug in Emacs.  Should be fixed on the trunk now.

BTW, please add an "ack--" prefix to your `project-root' var: all
`defvar'd variables should have such a prefix.

        Stefan