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

Skip to content

Support straight.el properly in dashboard-init-info #147

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 3 commits into from
Jun 7, 2019

Conversation

JesusMtnez
Copy link
Contributor

@JesusMtnez JesusMtnez commented Jun 4, 2019

  • Use (bound-and-true-p package-alist) to check if package.el is enabled.
  • Use (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache)) to check if straight.el is enabled.

This should fix discussion in #138

@romatthe could you please check if this works for you with straight.el?
@ema2159 I would also like your opinion on this

@ema2159
Copy link
Contributor

ema2159 commented Jun 4, 2019

Let me give it a try!

@raxod502
Copy link

raxod502 commented Jun 4, 2019

That seems less than optimal. What about (bound-and-true-p package-alist)? That will trigger if and only if package.el is loaded and initialized and at least one package was activated.

Of course, this only works after startup.

@JesusMtnez
Copy link
Contributor Author

May I know why it is less than optimal? I'm not an expert on elisp

@raxod502
Copy link

raxod502 commented Jun 4, 2019

Sure, no problem. Your code will trigger just because package.el was loaded, even if it's not being used. My code avoids that problem, since package-alist remains at nil until at least one package is actually loaded by package.el.

@JesusMtnez
Copy link
Contributor Author

Thank you @raxod502 for the explanation. I'll update this PR then

@raxod502
Copy link

raxod502 commented Jun 4, 2019

If you want to support straight.el, you could test for (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache)) and then check (hash-table-size straight--profile-cache) to get the number of packages. That said, this is unsupported and there really ought to be a supported way to get information about installed packages from straight.el.

@JesusMtnez JesusMtnez force-pushed the fix/show-number-of-package-when-using-package.el branch from 0e169b3 to 23a0b4f Compare June 4, 2019 16:48
@JesusMtnez JesusMtnez force-pushed the fix/show-number-of-package-when-using-package.el branch from 23a0b4f to f654e9e Compare June 4, 2019 16:49
@JesusMtnez
Copy link
Contributor Author

Thank you @raxod502 for your suggestions, I've applied them so we could provide a proper support not only for package.el but also straight.el. Does it look good now?

@romatthe could you also check if this works well for you ?

@JesusMtnez JesusMtnez changed the title Check package.el using featurep Support straight.el properly in dashboard-init-info Jun 4, 2019
@ema2159
Copy link
Contributor

ema2159 commented Jun 6, 2019

@JesusMtnez this doesn't seem to work either. What could be the problem?

@raxod502
Copy link

raxod502 commented Jun 6, 2019

I don't use this package, but evaluating that variable definition in my Emacs session does indeed give

"145 packages loaded in 0.8 seconds"

@ema2159
Copy link
Contributor

ema2159 commented Jun 6, 2019

I don't use this package, but evaluating that variable definition in my Emacs session does indeed give

"145 packages loaded in 0.8 seconds"

You're right, I forgot to byte compile jaja it does work.

@JesusMtnez JesusMtnez merged commit e7f76cf into master Jun 7, 2019
@JesusMtnez JesusMtnez deleted the fix/show-number-of-package-when-using-package.el branch June 7, 2019 05:08
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.

3 participants