Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Circumvented use of package-activated-list if package.el is not used #138

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

Merged
merged 2 commits into from
Jun 2, 2019

Conversation

romatthe
Copy link
Contributor

This should fix #136.

I tried to look around to see if there was a very reliable way to determine if package.el is being used. Unfortunately, I didn't really find a foolproof method. This PR is my best attempt at providing something that is somewhat reliable, and it at least solves my issue.

My Emacs and Elisp skills are basically terrible, so feel free to reject this if it's not up to snuff.

@JesusMtnez JesusMtnez merged commit 4ce61e8 into emacs-dashboard:master Jun 2, 2019
@ema2159
Copy link
Contributor

ema2159 commented Jun 4, 2019

Why does this causes the package number to never be shown?

@JesusMtnez
Copy link
Contributor

As far as I understood, if you are not using package.el, the number of packages will not be shown. But if you are using package.el it should show the number

@ema2159
Copy link
Contributor

ema2159 commented Jun 4, 2019

That's odd, even if my package-enable-at-startup is t, my packages are not displayed. Are your packages being displayed?

@JesusMtnez
Copy link
Contributor

I'll check it later again. Maybe we missed something

@romatthe
Copy link
Contributor Author

romatthe commented Jun 4, 2019

I seem to remember it worked just fine when I tried it.
Sorry about this guys.

@romatthe
Copy link
Contributor Author

romatthe commented Jun 4, 2019

It's possible I may have misunderstood how package-enable-at-startup is treated.
From the docstring of package-initialize in package.el for Emacs 26.2:

If `user-init-file' does not mention `(package-initialize)', add
it to the file.
If called as part of loading `user-init-file', set
`package-enable-at-startup' to nil, to prevent accidentally
loading packages twice.
It is not necessary to adjust `load-path' or `require' the
individual packages after calling `package-initialize' -- this is
taken care of by `package-initialize'."

I find this a little confusing, but it seems like package-enable-at-startup is set to nil if you call (package-initialize) from your init.el.

In any case, it seems my fix is simply wrong.

A quick workaround would be to simply perform the bound-check on package-activated-list, but I thought that felt a little more hacky.

@raxod502 Sorry for bothering you about this, but do you know of a reliable way to determine if someone is using the regular package.el or if they are using an alternative like your straight.el?

@JesusMtnez
Copy link
Contributor

Possible fix here: #147

@ema2159
Copy link
Contributor

ema2159 commented Jun 4, 2019

It's possible I may have misunderstood how package-enable-at-startup is treated.
From the docstring of package-initialize in package.el for Emacs 26.2:

If `user-init-file' does not mention `(package-initialize)', add
it to the file.
If called as part of loading `user-init-file', set
`package-enable-at-startup' to nil, to prevent accidentally
loading packages twice.
It is not necessary to adjust `load-path' or `require' the
individual packages after calling `package-initialize' -- this is
taken care of by `package-initialize'."

I find this a little confusing, but it seems like package-enable-at-startup is set to nil if you call (package-initialize) from your init.el.

In any case, it seems my fix is simply wrong.

A quick workaround would be to simply perform the bound-check on package-activated-list, but I thought that felt a little more hacky.

@raxod502 Sorry for bothering you about this, but do you know of a reliable way to determine if someone is using the regular package.el or if they are using an alternative like your straight.el?

Relax brother, you just addressed a problem you were having and tried to fix it! Nothing wrong about that! It's cool, we'll find a solution! That's the fun thing about contributing, if you get it wrong there's nothing to worry about, there will likely be people that are willing to help you! 😄

(length package-activated-list) (emacs-init-time))
(defvar dashboard-init-info
;; Check if package.el was loaded and if package loading was enabled
(if (bound-and-true-p package-enable-at-startup)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is not solid. package can be used although package-enable-at-startup is nil.

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

Successfully merging this pull request may close these issues.

Issues with use-package and straight.el
4 participants