1
0
Fork 0
mirror of https://github.com/correl/melpa.git synced 2024-12-28 19:19:21 +00:00
melpa/melpa.el

111 lines
3.1 KiB
EmacsLisp
Raw Normal View History

;;; melpa.el --- special handling for the MELPA repository
;;
;; Copyright 2012 Donald Ephraim Curtis
;;
;; Author: Donald Ephraim Curtis <dcurtis@milkbox.net>
;; URL: https://github.com/milkypostman/melpa
;; Version: 0.3
;;
2012-01-29 00:05:24 +00:00
;;
;; Credits:
;; Steve Purcell
;;
;;
;; Installation:
;;
;; (progn
;; (switch-to-buffer
;; (url-retrieve-synchronously
;; "https://raw.github.com/milkypostman/melpa/master/melpa.el"))
;; (package-install-from-buffer (package-buffer-info) 'single))
;;
;;
;;
;; Code goes here
;;
2012-01-28 23:57:50 +00:00
;;;###autoload
2012-01-28 23:57:50 +00:00
(defcustom package-archive-enable-alist nil
"Optional Alist of enabled packages used by `package-filter'.
The format is (ARCHIVE . PACKAGE ...), where ARCHIVE is a string
matching an archive name in `package-archives', PACKAGE is a
symbol of a package in ARCHIVE to enable.
If no ARCHIVE exists in the alist, all packages are enabled."
:group 'package
:type '(alist :key-type string :value-type (repeat symbol)))
;;;###autoload
2012-01-28 23:57:50 +00:00
(defcustom package-archive-exclude-alist nil
"Alist of packages excluded by `package-filter'.
The format is (ARCHIVE . PACKAGE ...), where ARCHIVE is a string
matching an archive name in `package-archives', PACKAGE is a
symbol of a package in that archive to exclude.
Any specified package is excluded regardless of the value of
`package-archive-enable-alist'"
:group 'package
:type '(alist :key-type string :value-type (repeat symbol)))
;;;###autoload
(defcustom package-filter-function 'package-filter
"Optional predicate function used to internally
filter packages used by package.el.
Return nil to filter a function from the list.
The function is called with the arguments PACKAGE VERSION ARCHIVE, where
PACKAGE is a symbol, VERSION is a vector as produced by `version-to-list', and
ARCHIVE is the string name of the package archive."
:group 'package
:type 'function)
;;;###autoload
(defadvice package-compute-transaction
(before
package-compute-transaction-reverse (package-list requirements)
activate compile)
"reverse the requirements"
(setq requirements (reverse requirements))
(print requirements))
2012-01-28 23:57:50 +00:00
;;;###autoload
(defadvice package--add-to-archive-contents
2012-01-28 23:57:50 +00:00
(around package-filter-add-to-archive-contents (package archive)
activate compile)
2012-01-28 23:57:50 +00:00
"Add filtering of available packages using `package-filter-function',
if non-nil."
(when (and package-filter-function
(funcall package-filter-function
(car package)
(package-desc-vers (cdr package))
archive))
ad-do-it))
2012-01-28 23:57:50 +00:00
;;;###autoload
(defun package-filter (package version archive)
"Check package against enabled and excluded list for the `archive'.
Filter packages not in the associated list for `archive' in
`package-archive-enable-alist'.
Filter packages in the associated list for `archive' in
`package-archive-exclude-alist'."
(let ((enable-rules (cdr (assoc archive package-archive-enable-alist)))
2012-01-31 03:19:06 +00:00
(exclude-rules (cdr (assoc archive package-archive-exclude-alist))))
2012-01-28 23:57:50 +00:00
(and (not (memq package exclude-rules))
2012-01-31 03:19:06 +00:00
(or (not enable-rules)
(memq package enable-rules)))))
2012-01-28 23:57:50 +00:00
(provide 'melpa)
;;; melpa.el ends here