[Top][All Lists]

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

Re: "reference to free variable" only during initialization

From: Yuri D'Elia
Subject: Re: "reference to free variable" only during initialization
Date: Wed, 25 Jan 2017 18:15:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

On Mon, Jan 16 2017, Noam Postavsky wrote:
>> 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.

This explains one difference, but it would mean that when the warning is
not delayed, it would be lost[!]. That would be more serious.

I assumed instead that defadvice was evaluating the body too early,
before defvar (and thus generating an /incorrect/ warning).

>>   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

Actually, it doesn't work. No warning is generated in this case.

But if I do the opposite: set after-init-time in the beginning of my
~/.emacs, then I can suppress the warning which indeed suggests some
problem with the delaying.

reply via email to

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