radian-software / straight.el

🍀 Next-generation, purely functional package manager for the Emacs hacker.
MIT License
2.72k stars 150 forks source link

straight-dependencies/dependencies functions don't recognize certain packages #1007

Open dadinn opened 1 year ago

dadinn commented 1 year ago

What's wrong

trying to interactively call straight-dependencies or straight-dependents does not find via completion large number of packages (e.g. hydra, dash, etc).

Not sure if the problem is with straight or with selectrum, as I use both.

Directions to reproduce

M-x straight-dependencies ^M, then type da initials for dash. No completion will be offered, without which it is not possible to call the function.

Version information

progfolio commented 1 year ago

straight-dependencies only works for packages which have external dependencies (not files which are included with Emacs). It looks like "dash" only declares a minimum Emacs version and hydra requires "cl-lib" and "lv", which are both built in.

I don't recall whether straight-dependents works similarly, but I believe it does.

dadinn commented 1 year ago

Why this restriction needed? Just because a package has no dependency (either external or built-in), it would be fair to return an empty list or nil.

At least it should be possible to ask straight what dependencies available packages have. I would argue that not being able to query those packages is more confusing, than being told that no dependencies were found, even thought there are built-in dependencies for the package.

A doc-string on the straight-dependencies function could explain this behaviour, or maybe the function should be renamed to straight-non-built-in-dependencies or straight-external-dependencies.

Also, how do you find built-in dependencies of a package? Search for require calls in its source-code? Would it be possible to add such logic to the straight-dependencies function?

progfolio commented 1 year ago

Why this restriction needed? Just because a package has no dependency (either external or built-in), it would be fair to return an empty list or nil.

This should be the case when it is used programmatically. It just doesn't offer such packages when used interactively. I don't see the point in offering a completion for a package and then telling the user "nothing is associated with this package". Is there a particular use case you have in mind?

A doc-string on the straight-dependencies function could explain this behaviour, or maybe the function should be renamed to straight-non-built-in-dependencies or straight-external-dependencies.

A pull request to the docstring is welcome if you're inclined. We'd have to alias those names (as these are published, "public" commands) to change the names. I'm not sure the names you've proposed would clarify as well as a docstring patch would.

Would it be possible to add such logic to the straight-dependencies function?

Pull requests are welcome