(defun use-package-memoize (f arg)
"Ensure the macro-expansion of F applied to ARG evaluates ARG
no more than once."
- (let ((loaded (cl-gensym "use-package--loaded"))
- (result (cl-gensym "use-package--result"))
- (next (cl-gensym "use-package--next")))
- `((lexical-let (,loaded ,result)
- ,@(funcall f `((if ,loaded
- ,result
- (setq ,loaded t)
- (setq ,result ,arg))))))))
+ (let* ((loaded (cl-gensym "use-package--loaded"))
+ (result (cl-gensym "use-package--result"))
+ (next (cl-gensym "use-package--next"))
+ (body `(lexical-let (,loaded ,result)
+ ,@(funcall f `((if ,loaded
+ ,result
+ (setq ,loaded t)
+ (setq ,result ,arg)))))))
+ `(,(if (eq use-package-verbose 'errors)
+ body
+ (macroexpand body)))))
(defsubst use-package-normalize-value (label arg)
"Normalize the Lisp value given by ARG.
(eval-after-load 'quux
'(if ,_ ,_
(setq ,_ t)
- (setq ,_ (require 'foo nil nil)))))))
- ))
+ (setq ,_ (require 'foo nil nil)))))))))
(ert-deftest use-package-test/:after-7 ()
(match-expansion
(eval-after-load 'bow
'(if ,_ ,_
(setq ,_ t)
- (setq ,_ (require 'foo nil nil)))))
- ))
+ (setq ,_ (require 'foo nil nil)))))))
(ert-deftest use-package-test/:after-8 ()
(match-expansion
(eval-after-load 'quux
'(if ,_ ,_
(setq ,_ t)
- (setq ,_ (require 'foo nil nil)))))))
- ))
+ (setq ,_ (require 'foo nil nil)))))))))
(ert-deftest use-package-test/:after-9 ()
(match-expansion
'(eval-after-load 'bow
'(if ,_ ,_
(setq ,_ t)
- (setq ,_ (require 'foo nil nil))))))
- ))
+ (setq ,_ (require 'foo nil nil))))))))
(ert-deftest use-package-test/:after-10 ()
(match-expansion
(eval-after-load 'baz
'(if ,_ ,_
(setq ,_ t)
- (setq ,_ (require 'foo nil nil)))))
- ))
+ (setq ,_ (require 'foo nil nil)))))))
(ert-deftest use-package-test/:demand-1 ()
(match-expansion