Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

byte-compiling reference to free variables using defines and functions seems to not be working #795

Open
kirk86 opened this issue Oct 15, 2019 · 6 comments
Labels

Comments

@kirk86
Copy link

kirk86 commented Oct 15, 2019

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
image

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

@willbush
Copy link

willbush commented May 3, 2020

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.

@tshu-w
Copy link

tshu-w commented Aug 12, 2020

same issue here, any update? @jwiegley

@jwiegley
Copy link
Owner

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.

@tshu-w
Copy link

tshu-w commented Aug 12, 2020

@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

@jwiegley
Copy link
Owner

jwiegley commented Aug 12, 2020

Well, certainly using declare-function can't hurt. :functions is only there for convenience.

@tshu-w
Copy link

tshu-w commented Aug 13, 2020

@jwiegley Thx your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants