[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b80a2cbdb67: Fix byte compiler warnings in window-tool-bar.el
From: |
Eli Zaretskii |
Subject: |
master b80a2cbdb67: Fix byte compiler warnings in window-tool-bar.el |
Date: |
Sun, 19 May 2024 02:42:28 -0400 (EDT) |
branch: master
commit b80a2cbdb677a8954f00f3394c2f8050ed511ad4
Author: Jared Finder <jared@finder.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix byte compiler warnings in window-tool-bar.el
* lisp/window-tool-bar.el (window-tool-bar--static-if)
(window-tool-bar--ignored-event-types): Avoid byte compiler
seeing variables obsolete in Emacs 30 and up. (Bug#68765)
---
lisp/window-tool-bar.el | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/lisp/window-tool-bar.el b/lisp/window-tool-bar.el
index 640deccdd61..395aa3aa9cc 100644
--- a/lisp/window-tool-bar.el
+++ b/lisp/window-tool-bar.el
@@ -335,15 +335,34 @@ 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 (list 'mouse-movement 'pinch
- 'wheel-down 'wheel-up 'wheel-left 'wheel-right
+ (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")
+ (list
mouse-wheel-down-event mouse-wheel-up-event
mouse-wheel-left-event mouse-wheel-right-event
(bound-and-true-p mouse-wheel-down-alternate-event)
(bound-and-true-p mouse-wheel-up-alternate-event)
(bound-and-true-p mouse-wheel-left-alternate-event)
- (bound-and-true-p mouse-wheel-right-alternate-event))))
+ (bound-and-true-p mouse-wheel-right-alternate-event))
+ nil))))
(delete-dups (delete nil list)))
"Cache for `window-tool-bar--last-command-triggers-refresh-p'.")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master b80a2cbdb67: Fix byte compiler warnings in window-tool-bar.el,
Eli Zaretskii <=