aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2018-07-05 13:20:58 -0300
committerEuAndreh <eu@euandre.org>2018-07-05 13:20:58 -0300
commitb3111940a844e2ea28b30ecb2c25f9a79711006f (patch)
tree6e97c2abe4ba47d363441de0cc08079df791a7cb
parentCleanup Spacemacs custom Elisp code (diff)
downloaddotfiles-b3111940a844e2ea28b30ecb2c25f9a79711006f.tar.gz
dotfiles-b3111940a844e2ea28b30ecb2c25f9a79711006f.tar.xz
Add measure-time utility helper macro
-rw-r--r--spacemacs.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/spacemacs.el b/spacemacs.el
index 8d5c5ee..9db0854 100644
--- a/spacemacs.el
+++ b/spacemacs.el
@@ -522,6 +522,14 @@ in the dump."
("M-SPC" . (lambda () (interactive) (just-one-space -1)))
("M-[" . (lambda () (interactive) (find-file "~/tmp/scratch.org")))))
+(defmacro measure-time (&rest body)
+ "Measure and return the running time of the code block."
+ (declare (indent defun))
+ (let ((start (make-symbol "start")))
+ `(let ((,start (float-time)))
+ ,@body
+ (- (float-time) ,start))))
+
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after layers configuration.