From 80aad34a39f72d5cf0e5a1bc4bc50f0c3c340eb9 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 21 Mar 2015 04:19:33 -0500 Subject: [PATCH] Add new customization use-package-always-ensure Fixes https://github.com/jwiegley/use-package/issues/27 --- lisp/use-package/use-package.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index c4959ce48da..78f1281dbb3 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -65,6 +65,11 @@ then the expanded macros do their job silently." :type 'boolean :group 'use-package) +(defcustom use-package-always-ensure nil + "Treat every package as though it had specified `:ensure SEXP`." + :type 'sexp + :group 'use-package) + (defcustom use-package-minimum-reported-time 0.1 "Minimal load time that will be reported. @@ -973,10 +978,14 @@ this file. Usage: (declare (indent 1)) (unless (member :disabled args) (let* ((name-symbol (if (stringp name) (intern name) name)) + (args0 (use-package-plist-maybe-put + (use-package-normalize-plist name-symbol args) + :config '(t))) (args* (use-package-sort-keywords - (use-package-plist-maybe-put - (use-package-normalize-plist name-symbol args) - :config '(t))))) + (if use-package-always-ensure + (use-package-plist-maybe-put + args0 :ensure use-package-always-ensure) + args0)))) ;; When byte-compiling, pre-load the package so all its symbols are in ;; scope. -- 2.39.2