From 990f9f4fa1dbcb9caf7dc6860f73e0d5ba68df74 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Wed, 2 Jun 2021 21:45:23 +0000 Subject: [PATCH] Make undercover--message a macro Don't even evaluate the log arguments if the level is above the verbosity. --- undercover.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/undercover.el b/undercover.el index 15a00ba..ed49125 100644 --- a/undercover.el +++ b/undercover.el @@ -154,11 +154,11 @@ LEVEL is ignored in this default implementation." (ignore level) (apply #'message (concat "UNDERCOVER: " format-string) args)) -(defun undercover--message (level format-string &rest args) - "Call `undercover-message-function'." +(defmacro undercover--message (level format-string &rest args) + "Call `undercover-message-function', if the configured verbosity allows it." (declare (indent 1)) - (when (<= level undercover--verbosity) - (apply undercover-message-function level format-string args))) + `(when (<= ,level undercover--verbosity) + (apply undercover-message-function ,level ,format-string (list ,@args)))) ;; ----------------------------------------------------------------------------