Subject: [PATCH] window-tool-bar: Use `static-if' from Compat 30

From: Daniel Mendler <[email-masked]>
Date: Sat, 08 Mar 2025 09:26:57 +0100

Tags: patch

Compat 30 is available on ELPA and provides `static-if'.

>From e2a734e891112756ec047bc02801091036f7085c Mon Sep 17 00:00:00 2001
From: Daniel Mendler <[email-masked]>
Date: Sat, 8 Mar 2025 09:23:53 +0100
Subject: [PATCH] window-tool-bar: Use `static-if' from Compat 30

* lisp/window-tool-bar.el (window-tool-bar--static-if): Remove
(window-tool-bar--ignored-event-types): Use `static-if' from Compat
instead.
---
 lisp/window-tool-bar.el | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/lisp/window-tool-bar.el b/lisp/window-tool-bar.el
index 96726960fea..08f8e41f6c2 100644
--- a/lisp/window-tool-bar.el
+++ b/lisp/window-tool-bar.el
@@ -7,7 +7,7 @@
 ;; Version: 0.3
 ;; Keywords: mouse
 ;; URL: http://github.com/chaosemer/window-tool-bar
-;; Package-Requires: ((emacs "27.1") (compat "29.1"))
+;; Package-Requires: ((emacs "27.1") (compat "30"))
 
 ;; This is a GNU ELPA :core package.  Avoid adding functionality that
 ;; is not available in the version of Emacs recorded above or any of
@@ -385,26 +385,13 @@ window-tool-bar--ignore
   (interactive)
   nil)
 
-;; static-if was added in Emacs 30, but this packages supports earlier
-;; versions.
-(defmacro window-tool-bar--static-if (condition then-form &rest else-forms)
-  "A conditional compilation macro.
-Evaluate CONDITION at macro-expansion time.  If it is non-nil,
-expand the macro to THEN-FORM.  Otherwise expand it to ELSE-FORMS
-enclosed in a `progn' form.  ELSE-FORMS may be empty."
-  (declare (indent 2)
-           (debug (sexp sexp &rest sexp)))
-  (if (eval condition lexical-binding)
-      then-form
-    (cons 'progn else-forms)))
-
 (defvar window-tool-bar--ignored-event-types
   (let ((list (append
                '(mouse-movement pinch
                  wheel-down wheel-up wheel-left wheel-right)
                ;; Prior to emacs 30, wheel events could also surface as
                ;; mouse-<NUM> buttons.
-               (window-tool-bar--static-if (version< emacs-version "30")
+               (static-if (< emacs-major-version 30)
                    (list
                     mouse-wheel-down-event mouse-wheel-up-event
                     mouse-wheel-left-event mouse-wheel-right-event
-- 
2.47.2