[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: |
Sat, 18 Feb 2017 23:18:59 -0500 |
On Sat, Feb 18, 2017 at 6:01 PM, Yuri D'Elia <address@hidden> wrote:
> with ~/.emacs.d/lisp containing modeline-posn.el from melpa. There's no
> other file. I indeed had to add (package-initialize) to reproduce the
> issue, but I'm not sure why it has some influence. Maybe just some
> delay.
>
> Right off the bat, could you reproduce it with this?
Yes, the reason package-initialize matters is just that it loads
bytecomp and advice.el only decides to compile if that has been
loaded:
(defun ad-should-compile (function compile)
(cond
...
;; everything else means `maybe':
(t (featurep 'byte-compile))))
(bytecomp.el provides both `bytecomp' and `byte-compile').
>
> Evaling after-init-time makes no difference,
--eval '(setq after-init-time t)' has no effect, but doing
(let ((after-init-time t))
(require 'modeline-posn))
in the init.el file does prevent the warning from popping up. It also
improves the error message: the prefix becomes
".emacs.d/lisp/modeline-posn.el:Warning:" instead of "Warning
(bytecomp):". This is because byte compilation is let-binding
warning-prefix-function which is not saved for delayed warnings.