]> git.eshelyaron.com Git - emacs.git/commitdiff
Add a :demand directive, to override deferred loading ()
authorJohn Wiegley <johnw@newartisans.com>
Thu, 5 Dec 2013 01:44:09 +0000 (19:44 -0600)
committerJohn Wiegley <johnw@newartisans.com>
Thu, 5 Dec 2013 01:44:09 +0000 (19:44 -0600)
GitHub-reference: https://github.com/jwiegley/use-package/issues/65

lisp/use-package/use-package.el

index d2e065a3ffa17be969098cb9bc642a202f8f1017..f4d5e7b6f380a13ecfb76f456171b3de55d44f9b 100644 (file)
      :config
      :defer
      :defines
+     :demand
      :diminish
      :disabled
      :ensure
@@ -383,7 +384,7 @@ Return the list of recognized keywords."
   (eval (list '\` (plist-get plist prop))))
 
 (defmacro use-package (name &rest args)
-"Use a package with configuration options.
+  "Use a package with configuration options.
 
 For full documentation. please see commentary.
 
@@ -401,6 +402,7 @@ For full documentation. please see commentary.
 :interpreter Form to be added to `interpreter-mode-alist'.
 :defer Defer loading of package -- automatic
        if :commands, :bind, :mode or :interpreter are used.
+:demand Prevent deferred loading in all cases.
 :config Runs if and when package loads.
 :if Conditional loading.
 :disabled Ignore everything.
@@ -465,7 +467,7 @@ For full documentation. please see commentary.
                          `((diminish (quote ,diminish-var))))
                         ((and (consp diminish-var) (stringp (cdr diminish-var)))
                          `((diminish (quote ,(car diminish-var)) ,(cdr diminish-var))))
-                        (t ; list of symbols or (symbol . "string") pairs
+                        (t      ; list of symbols or (symbol . "string") pairs
                          (mapcar (lambda (var)
                                    (if (listp var)
                                        `(diminish (quote ,(car var)) ,(cdr var))
@@ -481,7 +483,7 @@ For full documentation. please see commentary.
               `(progn
                  (require 'use-package)
                  (use-package-init-on-idle (lambda () ,idle-body))
-                   ,init-body)))
+                 ,init-body)))
 
 
       (let ((init-for-commands
@@ -534,12 +536,13 @@ For full documentation. please see commentary.
 
          (eval-when-compile
            (when (bound-and-true-p byte-compile-current-file)
-            ,@defines-eval
-            ,(if (stringp name)
-                 `(load ,name t)
-               `(require ',name nil t))))
+             ,@defines-eval
+             ,(if (stringp name)
+                  `(load ,name t)
+                `(require ',name nil t))))
 
-         ,(if (or commands (plist-get args :defer))
+         ,(if (and (or commands (plist-get args :defer))
+                   (not (plist-get args :demand)))
               (let (form)
                 (mapc #'(lambda (command)
                           (push `(autoload (function ,command)