Make install check aware of alternative package managers#1007
Conversation
rswgnu
left a comment
There was a problem hiding this comment.
You are on the right track. I would finish it off and add quelpa.
| (defun hypb:users-package-manager () | ||
| "Return the package manager in use. | ||
| Current supported package managers are `straight', `elpaca', and `package'." | ||
| (cond ((and (featurep 'straight) (fboundp 'straight-use-package)) 'straight) |
There was a problem hiding this comment.
I read up on quelpa and it seems it is based on top of package.el. Users can mix installing using quelpa and package.el directly. So it is not clear a user would prefer to install the packages we dynamically depend on using quelpa. So we can let package.el handle a potential install for quelpa users. It will not cause any big problem for them if I understand things correctly.
754e1c6 to
01440cb
Compare
| (or (require 'markdown-mode nil t) | ||
| (pcase (hypb:users-package-manager) | ||
| ('package (when (or (not hypb:dependency-install-ask) | ||
| (y-or-n-p (format "Install `%s' to enable this feature? " 'markdown-mode))) | ||
| (unless (assoc "nongnu" package-archives) | ||
| (setq package-archives (cl-copy-list package-archives)) | ||
| (add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/") | ||
| t)) | ||
| (package-refresh-contents) | ||
| (package-install 'markdown-mode))) | ||
| (manager (hypb:notify-manual-install-needed 'markdown-mode manager))))) |
There was a problem hiding this comment.
This is implemented on its own to allow the insertion of nongnu if that is missing only in the case where package.el is used. An alternative would be to do that either always or if package.el is in use and then call hypb:require-package. Seeing it now it might more sense to do like that. WDYT?
rswgnu
left a comment
There was a problem hiding this comment.
Let's see together if we can reduce the number of these added support functions before merging this. We can go through it together when you have time.
What functions do you think makes sense to merge? Do you think the number of functions makes the code hard to understand? |
|
Just felt like a lot of functions when I first looked at it. I'll have to look at it more to figure out where we could merge in consultation with you. |
There are four new functions. But shall the number of functions matter? Yes, they are small but with a clear purpose. The ChangeLog is a bit hard to read but I tried to get all in there which might make it look more than it is!? Happy talk about it. |
* hypb.el (hypb:dependency-install-ask): Give user control if package shall be installed when using package.el. (hypb:users-package-manager): Users package manager. (hypb:package-el-install): Install package using package.el. (hypb:notify-manual-install-needed): Notify user manual install is needed. (hypb:ensure-dependency): Ensure package is available using hypb:package-el-install or hypb:notify-manual-install-needed. (hypb:require-package): Use hypb:ensure-dependency.
* hsys-consult.el (hsys-consult-require-version): (hsys-consult--org-roam-call-function): * hui-treemacs.el (treemacs): * hypb.el (hypb:activate-interaction-log-mode): Use hypb:require-package. * hyrolo.el (hyrolo-any-file-type-problem-p): User require to check if markdown-mode is available. (hyrolo-install-markdown-mode): Copy hypb:ensure-dependency but add nongnu if is missing to package-archives before installation.
* hyrolo.el (hyrolo-install-markdown-mode): Ask user for install of markdown-mode. * test/hy-test-dependencies.el (hypb:dependency-install-ask): Set to nil for not asking about installing dynamic dependencies during test, i.e. markdown-mode.
69b4a85 to
27e61c3
Compare
|
@rswgnu I've rebased it so it is possible to merge it so it will be possible for you to add require of denote if you want. |
What
Make install check aware of alternative package managers and avoid doing
package-install for those. Adding a
defcustomso users can choose to get anautomated install if using the standard
package.el.Why
There are multiple package managers so we can't assume users use
package.el. If it is not used then using it to install a package would likely
be an error an could damage a users setup or at least not be what the user
expects.
Supporting different package managers for an automatic install is beyond
where we want to go.
Note
The idea is to use
hypb:ensure-dependencyin all places where we today topackage-install-p. That would beBefore implementing that could you, @rswgnu, take a look at what you think of
using this idea? If that makes sense I can complete this Draft.