summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2015-03-16 02:54:43 -0500
committerJohn Wiegley <johnw@newartisans.com>2015-03-16 03:12:23 -0500
commit55d6bb00cac8bab2be81e16ca62fca28fc83af6b (patch)
treeaed855c33ca7f0d82494e02b1f4e2aa74ca95ae4
parent4029030eb564ef553d9135a6ec576786b0a0ea2a (diff)
downloademacs-55d6bb00ca.tar.gz
Add code to workaround an inefficiency with eval-after-load
This is currently disabled, as it leads to strange byte-compilation errors that need to be tracked down.
-rw-r--r--lisp/use-package/use-package.el31
1 files changed, 21 insertions, 10 deletions
diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el
index c1e5c36fb88..a619ded7727 100644
--- a/lisp/use-package/use-package.el
+++ b/lisp/use-package/use-package.el
@@ -386,7 +386,11 @@ the user specified.")
(if (listp var)
`(diminish (quote ,(car var)) ,(cdr var))
`(diminish (quote ,var))))
- (plist-get args :diminish)))))
+ (plist-get args :diminish))))
+
+ (config-defun (make-symbol (concat name-string "-config"))))
+
+ (setq commands (delete-dups commands))
;; Return the main body of the macro
(use-package-cat-maybes
@@ -412,6 +416,12 @@ the user specified.")
`(declare-function ,fn ,name-string))
(append (plist-get args :functions) commands)))
+ ;; (if (and defer-loading config-body)
+ ;; `((defun ,config-defun ()
+ ;; (use-package-with-elapsed-timer
+ ;; ,(format "Configuring package %s" name-string)
+ ;; ,@config-body))))
+
;; The user's initializations
(list (use-package-hook-injector name-string :init args))
@@ -419,17 +429,16 @@ the user specified.")
(use-package-cat-maybes
bindings
(if config-body
- (let ((body
- `(use-package-with-elapsed-timer
- ,(format "Configuring package %s"
- name-string)
- ,@config-body)))
- (list `(eval-after-load ',name
- ',body)))))
+ `((eval-after-load ',name
+ '(use-package-with-elapsed-timer
+ ,(format "Configuring package %s" name-string)
+ ,@config-body)))))
`((use-package-with-elapsed-timer
,(format "Loading package %s" name-string)
(if (not (require ',name-symbol nil t))
- (message "Could not load package %s" ,name-string)
+ (display-warning
+ 'use-package
+ (format "Could not load package %s" ,name-string) :error)
,@(use-package-cat-maybes
bindings
config-body)
@@ -485,7 +494,9 @@ this file. Usage:
(args*
(condition-case-unless-debug err
(use-package-normalize-plist name-symbol args)
- (error (message (error-message-string err))))))
+ (error
+ (display-warning 'use-package
+ (error-message-string err) :error)))))
;; Pin any packages that have been marked with `:pin'.
(let ((archive-name (plist-get args* :pin)))