From e7a343828ac2ca57231b2a124f4673db18f7ca50 Mon Sep 17 00:00:00 2001 From: Phillip Lord Date: Tue, 13 Aug 2013 11:40:54 +0100 Subject: [PATCH 1/2] Add a ":first" keyword for those occasions that it's necessary --- lisp/use-package/use-package.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index 4778c399dea..7fd276efae7 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -147,6 +147,11 @@ ;; value of `use-package-verbose'. Other good candidates for `:idle' are ;; `yasnippet', `auto-complete' and `autopair'. ;; +;; Finally, you may wish to use `:first'. This form runs before everything +;; else whenever the `use-package' form evals; the package in question will +;; never have been required. This can be useful, if you wish for instance, to +;; pull files from a git repository, or mount a file system. +;; ;; The `:bind' keyword takes either a cons or a list of conses: ;; ;; (use-package hi-lock @@ -401,6 +406,9 @@ For full documentation. please see commentary. :bind Perform key bindings, and define autoload for bound commands. :commands Define autoloads for given commands. +:first Code to run when `use-package' form evals and before + anything else. Unlike :init this form runs before the + package is required or autoloads added. :mode Form to be added to `auto-mode-alist'. :interpreter Form to be added to `interpreter-mode-alist'. :defer Defer loading of package -- automatic @@ -414,6 +422,7 @@ For full documentation. please see commentary. :idle adds a form to run on an idle timer" (let* ((commands (plist-get args :commands)) (pre-init-body (plist-get args :pre-init)) + (first-body (plist-get args :first)) (init-body (plist-get args :init)) (config-body (plist-get args :config)) (diminish-var (plist-get args :diminish)) @@ -441,6 +450,7 @@ For full documentation. please see commentary. ;; force this immediately -- one off cost (unless (plist-get args :disabled) + (let* ((ensure (plist-get args :ensure)) (package-name (or (and (eq ensure t) @@ -517,6 +527,7 @@ For full documentation. please see commentary. (plist-get args :interpreter))) `(progn + ,first-body ,@(mapcar #'(lambda (path) `(add-to-list 'load-path From aa357bc96ae4b6e2d05031343e187156c3fd4e58 Mon Sep 17 00:00:00 2001 From: Phillip Lord Date: Thu, 15 Aug 2013 11:54:29 +0100 Subject: [PATCH 2/2] Changed :first to :pre-load Updated and extended documentation. --- lisp/use-package/use-package.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index 7fd276efae7..1ff776ccdf7 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -147,10 +147,11 @@ ;; value of `use-package-verbose'. Other good candidates for `:idle' are ;; `yasnippet', `auto-complete' and `autopair'. ;; -;; Finally, you may wish to use `:first'. This form runs before everything +;; Finally, you may wish to use `:pre-load'. This form runs before everything ;; else whenever the `use-package' form evals; the package in question will ;; never have been required. This can be useful, if you wish for instance, to -;; pull files from a git repository, or mount a file system. +;; pull files from a git repository, or mount a file system. Like :init, +;; keeping this form as simple as possible makes sense. ;; ;; The `:bind' keyword takes either a cons or a list of conses: ;; @@ -406,7 +407,7 @@ For full documentation. please see commentary. :bind Perform key bindings, and define autoload for bound commands. :commands Define autoloads for given commands. -:first Code to run when `use-package' form evals and before +:pre-load Code to run when `use-package' form evals and before anything else. Unlike :init this form runs before the package is required or autoloads added. :mode Form to be added to `auto-mode-alist'. @@ -422,7 +423,7 @@ For full documentation. please see commentary. :idle adds a form to run on an idle timer" (let* ((commands (plist-get args :commands)) (pre-init-body (plist-get args :pre-init)) - (first-body (plist-get args :first)) + (pre-load-body (plist-get args :pre-load)) (init-body (plist-get args :init)) (config-body (plist-get args :config)) (diminish-var (plist-get args :diminish)) @@ -527,7 +528,7 @@ For full documentation. please see commentary. (plist-get args :interpreter))) `(progn - ,first-body + ,pre-load-body ,@(mapcar #'(lambda (path) `(add-to-list 'load-path