Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

Setting a variable before loading while byte-compiling #836

@cprussin

Description

@cprussin

👋 Hi use-package folks! I'm running into an annoying warning with evil-collection when byte-compiling. The evil-collection readme suggests the following use-package incantation:

(use-package evil
  :ensure t
  :init
  (setq evil-want-integration t) ;; This is optional since it's already set to t by default.
  (setq evil-want-keybinding nil)
  :config
  (evil-mode 1))

(use-package evil-collection
  :after evil
  :ensure t
  :config
  (evil-collection-init))

This works properly, but during byte-compile I still get the warning Warning (evil-collection): Make sure to set 'evil-want-keybinding' to nil before loading evil or evil-collection.. Presumably this is because use-package tries to load evil without running the :init block while byte-compiling. Is there a way to set some variables such that they get set before loading the package while byte-compiling? I tried using :preface but that didn't seem to do the trick, instead I got the error message Warning (evil-collection): 'evil-want-keybinding' was set to nil but not before loading evil. (so I guess :preface runs after loading the package when byte-compiling?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions