summary refs log tree commit diff stats
path: root/tag-emacs
diff options
context:
space:
mode:
authorAlan Pearce2016-09-19 16:26:43 +0200
committerAlan Pearce2016-09-19 16:26:43 +0200
commit66228313f2f8389da0aa8395bce96e297b0ba87e (patch)
treec81cfd7f5f2e8acc2fbca9dbddb34b6836e93862 /tag-emacs
parent37fe9b98b9ae0b1163a547cb17134caf051ebd0c (diff)
downloaddotfiles-66228313f2f8389da0aa8395bce96e297b0ba87e.tar.lz
dotfiles-66228313f2f8389da0aa8395bce96e297b0ba87e.tar.zst
dotfiles-66228313f2f8389da0aa8395bce96e297b0ba87e.zip
Emacs: Update package archive filtering (25.1)
Diffstat (limited to 'tag-emacs')
-rw-r--r--tag-emacs/emacs.d/init.org88
1 files changed, 24 insertions, 64 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index 0c9ac30..c66b767 100644
--- a/tag-emacs/emacs.d/init.org
+++ b/tag-emacs/emacs.d/init.org
@@ -36,74 +36,34 @@ the buffer to be empty.
 ** Use-package
 
 #+BEGIN_SRC emacs-lisp
-  (defvar melpa-include-packages '(minimal-theme
-                                   highlight-stages
-                                   relative-buffers
-                                   dired+
-                                   dired-subtree
-                                   dired-hacks-utils
-                                   dired-narrow
-                                   org-caldav
-                                   go-projectile
-                                   go-rename
-                                   go-guru
-                                   redshank
-                                   restclient
-                                   visual-regexp)
-    "Don't install any MELPA packages except these packages")
-
-  (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.")
-
-  ;; Don't take MELPA versions of certain packages
-  (setq package-filter-function
-        (lambda (package version archive)
-          (or (not (string-equal archive "melpa"))
-              ;; install package in whitelist
-              (memq package melpa-include-packages)
-              ;; use all color themes
-              (string-match (format "%s" package) "-theme"))))
-
-  (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)
-                       (funcall (if (fboundp 'package-desc-version)
-                                    'package--ac-desc-version
-                                  'package-desc-vers)
-                                (cdr package))
-                       archive))
-      ad-do-it))
-
   (eval-and-compile
-    (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
-                             ("marmalade" . "http://marmalade-repo.org/packages/")
-                             ("melpa-stable" . "http://stable.melpa.org/packages/")
-                             ("melpa" . "http://melpa.org/packages/"))
-          package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa")
-          package-pinned-packages '(("use-package" . melpa-stable)
-                                    ("diminish" . melpa-stable)
-                                    ("bind-key" . melpa-stable)))
-    (package-initialize)
-    (unless (package-installed-p 'use-package)
-      (package-refresh-contents)
-      (package-install 'use-package)))
+	(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
+							 ("marmalade" . "http://marmalade-repo.org/packages/")
+							 ("melpa-stable" . "http://stable.melpa.org/packages/")
+							 ("melpa" . "http://melpa.org/packages/"))
+		  package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa")
+		  package-pinned-packages '(("use-package" . melpa-stable)
+									("diminish" . melpa-stable)
+									("bind-key" . melpa-stable))
+		  package-archive-priorities '("melpa-stable" 10
+									   "gnu" 10
+									   "marmalade" 5
+									   "melpa" 0)
+		  package-menu-hide-low-priority t)
+	(package-initialize)
+	(unless (package-installed-p 'use-package)
+	  (package-refresh-contents)
+	  (package-install 'use-package)))
   (eval-when-compile (require 'use-package))
   (unless (featurep 'use-package)
-    (require 'diminish)
-    (require 'bind-key)
-    (use-package use-package
-      :commands (use-package-autoload-keymap)
-      :defer 5))
+	(require 'diminish)
+	(require 'bind-key)
+	(use-package use-package
+	  :commands (use-package-autoload-keymap)
+	  :defer 5))
   (setq use-package-verbose t
-        use-package-always-ensure t
-        package-enable-at-startup nil)
+		use-package-always-ensure t
+		package-enable-at-startup nil)
 #+END_SRC
 
 * Customize