From 30132d18f7536183525d3ae60dbb8cf6e0c1fb68 Mon Sep 17 00:00:00 2001 From: Paul Pogonyshev Date: Thu, 21 Sep 2023 20:59:36 +0200 Subject: [PATCH] Fix byte-compilation of tests and their execution when byte-compiled; errors were caused by `logview--test-with-file' evaluating `extra-customizations' at definition time. --- test/logview.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/logview.el b/test/logview.el index c19d5ae..3e28949 100644 --- a/test/logview.el +++ b/test/logview.el @@ -45,7 +45,9 @@ (:extra-customizations (setf extra-customizations (eval (pop body) t))) (:buffer-mode (setf buffer-mode (pop body))))) (dolist (customizable (custom-group-members 'logview nil)) - (when (eq (cadr customizable) 'custom-variable) + ;; Byte-compiled `let' with double-binding for the same variable behaves differently + ;; than non-byte-compiled... Avoid double-bindings to dodge this. + (when (and (eq (cadr customizable) 'custom-variable) (not (assq (car customizable) extra-customizations))) (push (list (car customizable) (list 'quote (eval (car (get (car customizable) 'standard-value)) t))) erase-customizations))) `(let (,@erase-customizations ,@extra-customizations @@ -78,10 +80,12 @@ ,@etc))) -(defun logview--test-view-customizations (&rest views) - `((logview--views '(,@views)) - (logview--views-initialized t) - (logview--views-need-saving nil))) +;; This can get called from `logview--test-with-file' at compilation time. +(eval-and-compile + (defun logview--test-view-customizations (&rest views) + `((logview--views '(,@views)) + (logview--views-initialized t) + (logview--views-need-saving nil)))) (ert-deftest logview-test-log4j-standard-1 ()