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

Local packages for private layers not loading #10417

Closed
agzam opened this issue Mar 1, 2018 · 9 comments
Closed

Local packages for private layers not loading #10417

agzam opened this issue Mar 1, 2018 · 9 comments

Comments

@agzam
Copy link
Contributor

agzam commented Mar 1, 2018

Description :octocat:

Local packages for private layers not loading

I have number of private layers in
dotspacemacs-configuration-layer-path
with local packages, e.g.:

my-layer/local/my-package/my-package.el

my-package listed in layer's package.el with :location local,
everything seems to be correct in init function and in use-package body. Most importantly it used to work. But it somehow stopped. And I can't figure out what has changed.

upd: it appears to be broken only in develop

System Info 💻

  • OS: gnu/linux
  • Emacs: 25.3.1
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 4fe1600)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
@agzam
Copy link
Contributor Author

agzam commented Mar 1, 2018

I have found a workaround. If use-package is used with :demand t - it works. I'm not sure what has changed, probably this need to be documented.

@myrgy
Copy link
Contributor

myrgy commented Mar 1, 2018

Now all packages loading is deferred. Seems like your doesnt expose autoloaded function. Could be used via :commands section of use-package

@myrgy
Copy link
Contributor

myrgy commented Mar 1, 2018

@bmag
Copy link
Collaborator

bmag commented Mar 3, 2018

Since 29c78ce, Spacemacs sets use-package-always-defer to t. Meaning, :defer t is implied in all use-package declarations, unless overridden by :demand t. The change was documented in e2b1cec.

If previously you had a package configured like this:

;; before `use-package-always-defer' change
(use-package foo
  :config (foo-mode))

You can restore the original correct behavior with this change:

;; after `use-package-always-defer' change
(use-package foo
  :demand t
  :config (foo-mode))

As @myrgy wrote, if it makes sense to defer the package until it's really needed, you can adapt your configuration to lazy-loading (e.g. via :commands) instead of restoring the non-deferred behavior.

@duianto
Copy link
Collaborator

duianto commented Mar 3, 2018

syl20bnr explained why the change was made, in this gitter message:

@/all I pushed an important change in develop branch. use-package will now try to lazy load packages by default so :defer t is not necessary anymore as it is implied. To force a package to load right away you need to add :demand t. As 90% of the packages are lazy loaded it makes more sense to do it this way. This may triggers some regression in some package configured by spacemacs and in your private configuration as well.

source: https://gitter.im/syl20bnr/spacemacs?at=5a963234e4d1c63604a34fd2

@syl20bnr
Copy link
Owner

syl20bnr commented Mar 4, 2018

I think this was a mistake to use use-package-always-defer as use-package is more and more used in place of a simple require. Setting use-package-always-defer to t simply breaks this use case.

Going to revert, sorry for the bad good idea :-)

Great work @bmag by the way 👍

@syl20bnr
Copy link
Owner

syl20bnr commented Mar 4, 2018

Reverted in commit: ebe4c60

@syl20bnr syl20bnr closed this as completed Mar 4, 2018
@agzam
Copy link
Contributor Author

agzam commented Mar 4, 2018

BTW, does anyone know if it's possible to use use-package :bind with spacemacs/set-leader-keys, or evil-define-key?. Or such things have to be in :config section?

@myrgy
Copy link
Contributor

myrgy commented Mar 10, 2018

@agzam , I suspect that use-package :bind might not work as expected because it is not aware about spacemacs leader keys "magic"
@syl20bnr , is it possible to describe proper ways in https://github.com/syl20bnr/spacemacs/blob/develop/doc/LAYERS.org ?

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

No branches or pull requests

5 participants