mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-12 17:10:43 -08:00
Merge pull request from peterhoeg/master
Check if an archive is valid when pinning GitHub-reference: https://github.com/jwiegley/use-package/issues/137
This commit is contained in:
commit
99642725c1
1 changed files with 51 additions and 35 deletions
|
|
@ -113,10 +113,10 @@ Return nil when the queue is empty."
|
||||||
(forms (gethash priority use-package-idle-forms))
|
(forms (gethash priority use-package-idle-forms))
|
||||||
(first-form (car forms))
|
(first-form (car forms))
|
||||||
(forms-remaining (cdr forms)))
|
(forms-remaining (cdr forms)))
|
||||||
(if forms-remaining
|
(if forms-remaining
|
||||||
(puthash priority forms-remaining use-package-idle-forms)
|
(puthash priority forms-remaining use-package-idle-forms)
|
||||||
(remhash priority use-package-idle-forms))
|
(remhash priority use-package-idle-forms))
|
||||||
first-form))
|
first-form))
|
||||||
|
|
||||||
(defun use-package-idle-eval()
|
(defun use-package-idle-eval()
|
||||||
"Start to eval idle-commands from the idle queue."
|
"Start to eval idle-commands from the idle queue."
|
||||||
|
|
@ -142,9 +142,25 @@ Return nil when the queue is empty."
|
||||||
(defun use-package-pin-package (package archive)
|
(defun use-package-pin-package (package archive)
|
||||||
"Pin PACKAGE to ARCHIVE."
|
"Pin PACKAGE to ARCHIVE."
|
||||||
(unless (boundp 'package-pinned-packages)
|
(unless (boundp 'package-pinned-packages)
|
||||||
(setq package-pinned-packages '()))
|
(setq package-pinned-packages ()))
|
||||||
(add-to-list 'package-pinned-packages (cons package archive))
|
(let ((archive-symbol (if (symbolp archive) archive (intern archive)))
|
||||||
(package-initialize t))
|
(archive-name (if (stringp archive) archive (symbol-name archive))))
|
||||||
|
(if (use-package--archive-exists-p archive-symbol)
|
||||||
|
(add-to-list 'package-pinned-packages (cons package archive-name))
|
||||||
|
(error (message "Archive '%s' requested for package '%s' is not available." archive-name package)))
|
||||||
|
(package-initialize t)))
|
||||||
|
|
||||||
|
(defun use-package--archive-exists-p (archive)
|
||||||
|
"Check if a given ARCHIVE is enabled.
|
||||||
|
|
||||||
|
ARCHIVE can be a string or a symbol or 'manual to indicate a manually updated package."
|
||||||
|
(if (member archive '(manual "manual"))
|
||||||
|
't
|
||||||
|
(let ((valid nil))
|
||||||
|
(dolist (pa package-archives)
|
||||||
|
(when (member archive (list (car pa) (intern (car pa))))
|
||||||
|
(setq valid 't)))
|
||||||
|
valid)))
|
||||||
|
|
||||||
(defun use-package-ensure-elpa (package)
|
(defun use-package-ensure-elpa (package)
|
||||||
(when (not (package-installed-p package))
|
(when (not (package-installed-p package))
|
||||||
|
|
@ -152,28 +168,28 @@ Return nil when the queue is empty."
|
||||||
|
|
||||||
(defvar use-package-keywords
|
(defvar use-package-keywords
|
||||||
'(
|
'(
|
||||||
:bind
|
:bind
|
||||||
:bind*
|
:bind*
|
||||||
:commands
|
:commands
|
||||||
:config
|
:config
|
||||||
:defer
|
:defer
|
||||||
:defines
|
:defines
|
||||||
:demand
|
:demand
|
||||||
:diminish
|
:diminish
|
||||||
:disabled
|
:disabled
|
||||||
:ensure
|
:ensure
|
||||||
:idle
|
:idle
|
||||||
:idle-priority
|
:idle-priority
|
||||||
:if
|
:if
|
||||||
:init
|
:init
|
||||||
:interpreter
|
:interpreter
|
||||||
:load-path
|
:load-path
|
||||||
:mode
|
:mode
|
||||||
:pin
|
:pin
|
||||||
:pre-init
|
:pre-init
|
||||||
:pre-load
|
:pre-load
|
||||||
:requires
|
:requires
|
||||||
)
|
)
|
||||||
"Keywords recognized by `use-package'.")
|
"Keywords recognized by `use-package'.")
|
||||||
|
|
||||||
(defun use-package-mplist-get (plist prop)
|
(defun use-package-mplist-get (plist prop)
|
||||||
|
|
@ -239,11 +255,11 @@ are all non-keywords elements that follow it."
|
||||||
"Error if any keyword given in ARGS is not recognized.
|
"Error if any keyword given in ARGS is not recognized.
|
||||||
Return the list of recognized keywords."
|
Return the list of recognized keywords."
|
||||||
(mapc
|
(mapc
|
||||||
(function
|
(function
|
||||||
(lambda (keyword)
|
(lambda (keyword)
|
||||||
(unless (memq keyword use-package-keywords)
|
(unless (memq keyword use-package-keywords)
|
||||||
(error "Unrecognized keyword: %s" keyword))))
|
(error "Unrecognized keyword: %s" keyword))))
|
||||||
(use-package-mplist-keys args)))
|
(use-package-mplist-keys args)))
|
||||||
|
|
||||||
(defmacro use-package (name &rest args)
|
(defmacro use-package (name &rest args)
|
||||||
"Use a package with configuration options.
|
"Use a package with configuration options.
|
||||||
|
|
@ -391,7 +407,7 @@ For full documentation. please see commentary.
|
||||||
(funcall init-for-commands
|
(funcall init-for-commands
|
||||||
#'(lambda (binding)
|
#'(lambda (binding)
|
||||||
`(bind-key* ,(car binding)
|
`(bind-key* ,(car binding)
|
||||||
(quote ,(cdr binding))))
|
(quote ,(cdr binding))))
|
||||||
overriding-keybindings-alist)
|
overriding-keybindings-alist)
|
||||||
|
|
||||||
(funcall init-for-commands
|
(funcall init-for-commands
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue