Skip to content

Instantly share code, notes, and snippets.

@purcell
Created January 28, 2012 15:15
Show Gist options
  • Save purcell/1694669 to your computer and use it in GitHub Desktop.
Save purcell/1694669 to your computer and use it in GitHub Desktop.
(defvar package-filter-function nil
"Optional predicate function used to internally filter packages used by package.el.
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.")
(defadvice package--add-to-archive-contents
(around filter-packages (package archive) activate)
"Add filtering of available packages using `package-filter-function', if non-nil."
(when (or (null package-filter-function)
(funcall package-filter-function
(car package)
(package-desc-vers (cdr package))
archive))
ad-do-it))
;; Only take certain packages from Melpa
(setq package-filter-function
(lambda (package version archive)
(or (not (string-equal archive "melpa"))
(memq package '(magit rvm slime)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment