From 55d6bb00cac8bab2be81e16ca62fca28fc83af6b Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 16 Mar 2015 02:54:43 -0500 Subject: [PATCH] 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. --- lisp/use-package/use-package.el | 31 +++++++++++++++++++++---------- 1 file 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))) -- 2.39.2