Subject: bug#76858: closed (Re: bug#76858: [PATCH] window-tool-bar: Use `static-if' from Compat 30)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 13 Mar 2025 06:00:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
76858: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76858
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#76858: [PATCH] window-tool-bar: Use `static-if' from Compat 30
From: Stefan Kangas <[email-masked]>
To: Jared Finder <[email-masked]>
Cc: Daniel Mendler <[email-masked]>, [email-masked]
Date: Wed, 12 Mar 2025 22:59:15 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 31.1

Jared Finder <[email-masked]> writes:

> On 2025-03-08 07:43, Daniel Mendler wrote:
>> Jared Finder <[email-masked]> writes:
>>
>>> On 2025-03-08 00:26, Daniel Mendler wrote:
>>>> Tags: patch
>>>> Compat 30 is available on ELPA and provides `static-if'.
>>> I see this created Bug#76858. (apologies if a new bug is created here)
>>>
>>>> -;; Package-Requires: ((emacs "27.1") (compat "29.1"))
>>>> +;; Package-Requires: ((emacs "27.1") (compat "30"))
>>> I think this also needs (eval-when-compile (require 'compat)) since static-if
>>> is
>>> a macro. But I could be wrong here, I'm always a bit confused about Emacs
>>> Lisp's
>>> eval-when forms.
>> No, (require 'compat) is sufficient.
>
> Ok, I have no objections then.
>
>   -- MJF

Thanks, installed on master as [1: ae33aad7f58].

[1: ae33aad7f58] 2025-03-13
  window-tool-bar: Use `static-if' from Compat 30
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=ae33aad7f582864a8dbb0fee10f891fd67abdbe3

Subject: [PATCH] window-tool-bar: Use `static-if' from Compat 30
From: Daniel Mendler <[email-masked]>
To: [email-masked]
Cc: Jared Finder <[email-masked]>
Date: Sat, 08 Mar 2025 09:26:57 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

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