[Top][All Lists]

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

Re: "reference to free variable" only during initialization

From: Noam Postavsky
Subject: Re: "reference to free variable" only during initialization
Date: Mon, 16 Jan 2017 18:47:01 -0500

On Mon, Jan 16, 2017 at 6:00 PM, Yuri D'Elia <address@hidden> wrote:
> I have an oddball warning that I have an hard time debugging. I upgraded
> to emacs 25.1.1 on a debian desktop recently, and started to get:
> Warning (bytecomp): reference to free variable ‘isearchp-reg-beg’
> during startup. The warning is generated by requiring
> modeline-posn.el[1], which is using ``isearchp-reg-beg`` (actually
> defvar-ed early on) inside a defadvice form.
> Is this expected?

There is some unexpected interaction of defadvice with delayed
warnings. I had noticed this a while back, but never got around to
fixing it. `ad-compile-function' binds `warning-suppress-types', but
if warnings are delayed, then the warning call happens after that
binding is finished.

> Warning aside, the intriguing part is that the warning /only/ occurs
> when (require 'modeline-posn) is evaluated in my ~/.emacs, but is not
> emitted instead when doing the "allegedly" equivalent:
>   emacs -q -l ~/.emacs

In this case, the warnings are not delayed. If you set after-init-time
to nil, then warnings will be delayed, so the same problem should
occur, I think:

    emacs -q --eval '(setq after-init-time nil)' -l ~/.emacs

I think Bug #24106 might be a similar case (and I'm pretty sure
there's another older one where I initially noticed this, but I can't
find it right now).

reply via email to

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