From: Jonas Bernoulli Date: Sun, 9 Mar 2014 17:50:01 +0000 (+0100) Subject: use-package-with-elapsed-timer: respect option at runtime X-Git-Tag: emacs-29.0.90~1306^2~15^2~416^2~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ea3a475d0be35a26429f8f7adf06ebabc8179586;p=emacs.git use-package-with-elapsed-timer: respect option at runtime Previously the option `use-package-verbose' was consulted at macro expansion time, and as a result customizing the option did nothing, without also recompiling `use-package.el'. --- diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index 45d361a4dd8..473eefb5090 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -58,19 +58,18 @@ :type 'number :group 'use-package) -(defmacro use-package-with-elapsed-timer (text &rest forms) - (let ((body `(progn ,@forms))) - (if use-package-verbose - (let ((nowvar (make-symbol "now"))) - `(let ((,nowvar (current-time))) - (message "%s..." ,text) - (prog1 ,body - (let ((elapsed - (float-time (time-subtract (current-time) ,nowvar)))) - (if (> elapsed ,use-package-minimum-reported-time) - (message "%s...done (%.3fs)" ,text elapsed) - (message "%s...done" ,text)))))) - body))) +(defmacro use-package-with-elapsed-timer (text &rest body) + (let ((nowvar (make-symbol "now"))) + `(if use-package-verbose + (let ((,nowvar (current-time))) + (message "%s..." ,text) + (prog1 (progn ,@body) + (let ((elapsed + (float-time (time-subtract (current-time) ,nowvar)))) + (if (> elapsed ,use-package-minimum-reported-time) + (message "%s...done (%.3fs)" ,text elapsed) + (message "%s...done" ,text))))) + ,@body))) (put 'use-package-with-elapsed-timer 'lisp-indent-function 1)