Skip to content
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

Specify repository for specific packages. #142

Open
samontea opened this issue Aug 18, 2020 · 3 comments
Open

Specify repository for specific packages. #142

samontea opened this issue Aug 18, 2020 · 3 comments

Comments

@samontea
Copy link
Contributor

I have a weird issue with proof general where I need to install it from melpa but not melpa-stable (because that version is 4 years out of date). It would be nice if we could override our package priorities for specific packages.

@cg505
Copy link
Contributor

cg505 commented Aug 21, 2020

wait I thought you could do this somehow already or am I boosted

@samontea
Copy link
Contributor Author

I only see us prioritizing repositories. Not allowing us to set repositories for specific packages. (source:

(defun kotct/package-latest-available (package)
"Get the lastest-available package-desc for PACKAGE, preferring repositories
as listed in `package-archive-priorities' or `kotct/package-ordered-archives'.
Does not automatically refresh the package list."
(if (version< emacs-version "25.1")
;; no package-archive-priorities, so use kotct/package-ordered-archives
(let* ((versions (cdr (assoc package package-archive-contents)))
;; check package-pinned-packages first
(pinned-archive (cdr (assoc package package-pinned-packages)))
(found-desc (when pinned-archive
(car (cl-member pinned-archive versions
:key #'package-desc-archive
:test #'string=)))))
(dolist (archive kotct/package-ordered-archives)
(when (not found-desc)
;; no match yet, keep looking
(setf found-desc (car (cl-member archive versions
:key #'package-desc-archive
:test #'string=)))))
found-desc)
;; package-archive-priorities means we only have to check
;; the first package-desc, because that should be from the best repo
(cadr (assoc package package-archive-contents))))
(defun kotct/package-up-to-date-p (package)
"Return non-nil if PACKAGE is installed and up-to-date.
Does not automatically refresh package list.
Before Emacs 25, we have to manually check in preferred-repository order."
(let ((latest (kotct/package-latest-available package)))
(when latest
(package-installed-p package (package-desc-version latest)))))
)

@rye
Copy link
Member

rye commented Aug 23, 2020

I second this idea, it would help quite a lot. (One anecdotal example: lsp-mode has been broken for a long time since flycheck hasn't released a stable version for nearly three years, but melpa (vs. melpa-stable) is working fine.)

One idea for how to implement this is to adjust the form of kotct/dependency-list a bit. Now, instead of just a list of symbols, kotct/dependency-list could be a list of both symbols and structs (?)—something like (just an idea):

'(
  linum-off ; just follow the defaults; prefer the default repository and latest version
  ; ...
  (flycheck :repository "melpa") ; configure the repository
  ; ...
)

(This structure would lend itself to extension with more keywords like :version later on.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants