window-tool-bar: Use `static-if' from Compat 30

* lisp/window-tool-bar.el (window-tool-bar--static-if): Remove macro.
(window-tool-bar--ignored-event-types): Use `static-if' from Compat
instead.  (Bug#76858)
This commit is contained in:
Daniel Mendler 2025-03-08 09:23:53 +01:00 committed by Stefan Kangas
parent 99d034cfd3
commit ae33aad7f5

View file

@ -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 @@ MENU-ITEM is a menu item to convert. See info node `(elisp)Tool Bar'."
(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