reliktary · 2022-10-25 11:36
hi everyone,
I recently switched to straight.el mostly for packages contributing purposes and it works really great.
In my init.el I sometimes use `package-installed-p` function to check if package is installed but straight.el doesn't install packages "emacs way" so that function always return nil. I expect there should be similar function in straight.el but I can't find one.
Do you know if it's exists?
Thanks
EDIT:
There is `straight--installed-p` but it expects a `RECIPE` and I don't really understand what is this. Definitely not a package name
MitchellMarquez42 · 2022-10-25 12:51
You might be able to use `featurep` instead (it checks for things you can 'require)
nv-elisp · 2022-10-25 13:30
Can you provide an example of how you are using `package-installed-p` in your init?
vifon · 2022-10-25 15:38
I'm pretty sure `featurep` checks whether a feature is already required.
reliktary · 2022-10-26 00:22
As an example, I use it to define `elfeed-feeds` variable in case `elfeed` package exists. I don't want to keep that list loaded in the memory.
And thanks a lot for this question, because it made me think at least a little bit and recall that it's emacs where I can do anything.
I currently store `elfeed-feeds` definition in a separate file since it's a big list. `use-package` call for `elfeed` is in separate file and I don't want to store that big list of feeds in there.
So I changed my config files a bit so `(use-package elfeed...)` defines `elfeed-feeds` in it's `:config` section and it takes that list from that elfeed specific .el file.
So now, if I don't need elfeed, that big file isn't gonna be loaded too.
Thanks a lot!
walseb · 2022-10-29 21:08
I just use `fboundp` on a function in the package. You could use it on a autoloaded function or just any function if the package is fully loaded. There is also `boundp`.