Closed budsbenzer closed 7 years ago
That's strange, I don't get that message when byte-compiling.
Have you tried replacing that snippet in your init file with (add-hook 'LaTeX-mode-hook #'latex-extra-mode)
? Do you still get the same errror?
Strange indeed. 😄 When I remove the package's .elc and recompile, there are no warnings. However, the warning appears again when I restart Emacs.
I replaced the (use-package ...)
by
(require 'latex-extra)
(add-hook 'LaTeX-mode-hook #'latex-extra-mode)
but the warning persists. When I remove the above from init.el and eval it in the scratch buffer instead, there are no warnings.
It may be a hack, but I managed to suppress the warning with
(let ((byte-compile-warnings '(not free-vars)))
(use-package latex-extra
:ensure t
:config
(add-hook 'LaTeX-mode-hook #'latex-extra-mode)))
Since I'm okay with that as a solution, I'll close the issue.
Alight. It might just be some compatibilty thing with a very specific version of auctex.
does this indicate an error, or is it free to ignore? i believe it might be some byte code compatibility issue. is there a better way than suppressing the message?
I confirm that this is still a problem, and indeed the
(add-hook 'LaTeX-mode-hook #'latex-extra-mode)
does not work. I need to activate the extra mode manually.
I am using:
(use-package latex-extra
:ensure t
:init (add-hook 'LaTeX-mode-hook #'latex-extra-mode))
I get the same warning, and the hook does work. I suspect there is a problem with use-package itself. I have tried the following before:
(use-package latex-extra
:ensure t
:hook (LaTeX-mode-hook . latex-extra-mode))
which should work according to their docs, but actually doesn't. And the solution with init
does work.
Nevertheless, the bytecomp warning still shows up.
I am not sure if it is related, but I cannot compile beamer files with C-c C-a
, but can articles.
I figured out a solution that does not require the hack, and why the :hook
specification above does not work.
First, the :hook
specification above does not work because it takes the 1st symbol inside ( ) and then appends -hook
to it. In this case, the first symbol is LaTeX-mode-hook
, and it will try to add latex-extra-mode
to the LaTeX-mode-hook-hook
hook.
So the correct way to call it is:
(use-package latex-extra
:ensure t
:hook (LaTeX-mode . latex-extra-mode))
Second, this also solves the problem with the bytecomp
error! I do not understand why exactly, but it seems that it defers adding the hook until the variable latex-extra-mode
is actually declared, and so we do not get a free variable
error.
No matter what I do I get the error below everytime I start emacs. Tried reinstalling the package, no difference. Current config is below. For years I used the (let ((byte-compile-warnings '(not **free-vars)))**
wrapping but now it makes no difference it's there or not.
GNU Emacs 27.0.60 (build 1, x86_64-w64-mingw32) of 2019-12-28
~/.emacs.d/elpa/latex-extra-20170817.147/latex-extra.elc:Warning: reference to
free variable ‘latex-extra-mode’
(use-package latex-extra
:mode ("\\.tex\\'" . TeX-latex-mode)
:hook
(LaTeX-mode . latex-extra-mode))
Since I upgraded to Emacs 25.1, I get the error message
Warning (bytecomp): reference to free variable ‘latex-extra-mode’
on startup. I include latex-extra in myinit.el
byMy Emacs version is
GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.9) of 2016-09-18
, while(lm-version)
evals to"1.13"
.By the way, the call to
(lm-version "latex-extra")
in functionlatex-bug-report
results in the error messagelm-version: Opening input file: No such file or directory, /home/XXX/.emacs.d/elpa/latex-extra-20160328.1721/latex-extra
.