emacs-devel
[Top][All Lists]
Advanced

[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: Wed, 25 Jan 2017 14:50:22 -0500

On Wed, Jan 25, 2017 at 12:15 PM, Yuri D'Elia <address@hidden> wrote:
> 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.

It shouldn't be lost, `warning-suppress-types' just stops the
*Warnings* buffer from popping up. The warnings are still logged in
the background.

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

Hmm, I can't reproduce your original case in 25.1 or 24.5, even after commenting

(defvar isearchp-reg-beg)                 ; In `isearch+.el'
(defvar isearchp-reg-end)                 ; In `isearch+.el'
(defvar isearchp-restrict-to-region-flag) ; In `isearch+.el'

at the top of modeline-posn.el. I have init.el with contents



reply via email to

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