From: Noam Postavsky Date: Sat, 31 Aug 2013 14:30:08 +0000 (-0400) Subject: with-elapsed-timer: only check verbosity once X-Git-Tag: emacs-29.0.90~1306^2~15^2~437^2~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=61fd933807ff23be89289c23cbc54caa3bdb2426;p=emacs.git with-elapsed-timer: only check verbosity once --- diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index eb3c7030108..33aa332fd16 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el @@ -321,18 +321,16 @@ :group 'use-package) (defmacro with-elapsed-timer (text &rest forms) - `(let ((now ,(if use-package-verbose - '(current-time)))) - ,(if use-package-verbose - `(message "%s..." ,text)) - (prog1 - ,@forms - ,(when use-package-verbose - `(let ((elapsed - (float-time (time-subtract (current-time) now)))) - (if (> elapsed ,use-package-minimum-reported-time) - (message "%s...done (%.3fs)" ,text elapsed) - (message "%s...done" ,text))))))) + (if use-package-verbose + `(let ((now (current-time))) + (message "%s..." ,text) + (prog1 ,@forms + (let ((elapsed + (float-time (time-subtract (current-time) now)))) + (if (> elapsed ,use-package-minimum-reported-time) + (message "%s...done (%.3fs)" ,text elapsed) + (message "%s...done" ,text))))) + `(prog1 ,@forms))) (put 'with-elapsed-timer 'lisp-indent-function 1)