redguardtoo / emacs.d

Fast and robust Emacs setup.
http://blog.binchen.org
GNU General Public License v3.0
2.39k stars 619 forks source link

Advice for require-package and featurep #1057

Open zhanyi22333 opened 9 months ago

zhanyi22333 commented 9 months ago

As an example, I use require-package to install and require 'vterm. And (featurep 'vterm) return nil.

And in another package vterm-toggle, it require vterm. The require function use featurep to define whether vterm is loaded. This lead to double load of vterm and lead emacs to crash finally.

I think the biggest problem is that require-package doesn't act like require when you check the symbol with featurep, which may lead to double load and is hard to detect.

ls there some way to fix it?

redguardtoo commented 8 months ago

Not sure what's the problem. require-package installs a package from elpa. require load a package if it can be found from load-path. featurep checks if a package is loaded. You can require a package multiple times. require has some builtin code works same way s featurep.