use-package
use-package copied to clipboard
byte-compiling reference to free variables using defines and functions seems to not be working
So, I have the following code in my init:
(use-package undo-tree
:defines undo-tree-visualizer-selection-mode
:commands undo-tree-mode
:ensure t
:config
(global-undo-tree-mode t))
I still get these at byte compilation time

As you can see both undo-tree-mode and undo-tree-visualizer-selection-mode are still there. I still can't wrap my head around what is the proper usage of :defines and :functions is there an order of precedence? Do the :defines and :functions have to come before :ensure? Can they be used together with :ensure? The examples in the readme didn't help me much (maybe I'm too stupid to understand how is this working).
I have the same issue. The :functions does not work for me. Instead I add something like (declare-function undo-tree-mode "undo-tree") to my :config block to fix the warning. I typically get this warning for functions provided by the package that I use in the :config block.
same issue here, any update? @jwiegley
There should be no order dependence of this sort, since keywords are always processed in these same order. In cases like this, I would suggest expanding the macro to see why things aren't behaving as you'd expect. The use of :functions for example should expand to using declare-function, at least when byte-compile-current-file is bound and non-nil.
@jwiegley yes, this is because my byte-compile-current-file is nil. But I wonder how to suppress flycheck warning? should I set byte-compile-current-file to t or use declare-function rather than :functions
Well, certainly using declare-function can't hurt. :functions is only there for convenience.
@jwiegley Thx your reply.