mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-05 03:39:38 +00:00
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'.
This commit is contained in:
parent
11195fa213
commit
ea3a475d0b
1 changed files with 12 additions and 13 deletions
|
@ -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
|
||||
(defmacro use-package-with-elapsed-timer (text &rest body)
|
||||
(let ((nowvar (make-symbol "now")))
|
||||
`(let ((,nowvar (current-time)))
|
||||
`(if use-package-verbose
|
||||
(let ((,nowvar (current-time)))
|
||||
(message "%s..." ,text)
|
||||
(prog1 ,body
|
||||
(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)))
|
||||
(message "%s...done" ,text)))))
|
||||
,@body)))
|
||||
|
||||
(put 'use-package-with-elapsed-timer 'lisp-indent-function 1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue