]> git.eshelyaron.com Git - emacs.git/commitdiff
Move :init forms before :after and :demand
authorJustin Burkett <justin@burkett.cc>
Thu, 23 Jun 2016 14:01:33 +0000 (10:01 -0400)
committerJustin Burkett <justin@burkett.cc>
Thu, 23 Jun 2016 14:01:33 +0000 (10:01 -0400)
The docstring of use-package says that :init should run before the
package is loaded but using :after moves the require statement ahead of
:init when any package specified in :after is already loaded. In the
following example, in the first case bar-x might get set before or after
bar is loaded depending on if foo is already loaded at the time, while
the second case always sets bar-x first.

(use-package bar
  :after (foo)
  :init (setq bar-x 2)
  :config (bar-mode))

(use-package bar
  :init (setq bar-x 2)
  :config (bar-mode))

This commit fixes the issue and makes sure that bar-x is set before bar
is loaded by use-package. Fixes https://github.com/jwiegley/use-package/issues/352.

lisp/use-package/use-package.el

index 8c47678117de0aeea29b4e37543bc96a354cb774..aeea5ea9244373169feddc1c74233fe64fab3ae4 100644 (file)
@@ -144,9 +144,9 @@ the user specified."
     :defines
     :functions
     :defer
+    :init
     :after
     :demand
-    :init
     :config
     :diminish
     :delight)