From 77cd3a406b500f4106dde4b925fe4fec30b4a2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 20 Apr 2025 13:24:52 +0100 Subject: [PATCH] Flymake: address some compatibility problems with older Emacsen Can't use with-supressed-warnings, introduced in Emacs 27.1. Also can't use multi-arg setq-local, probably introduced around the same time. This commit by itself still doesn't allow Flymake to be loaded in Emacs < 29. That fix will come in a later commit. * lisp/progmodes/flymake.el (flymake--mode-line-counter-map): Use with-no-warnings. * lisp/progmodes/flymake.el (flymake--resize-margins): Use setq, setq-local not needed. --- lisp/progmodes/flymake.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 2ea91ccb15c..65733ad9568 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -871,14 +871,14 @@ Return to original margin width if ORIG-WIDTH is non-nil." (cond ((and orig-width flymake--original-margin-width) (if (eq flymake-margin-indicator-position 'left-margin) - (setq-local left-margin-width flymake--original-margin-width) - (setq-local right-margin-width flymake--original-margin-width))) + (setq left-margin-width flymake--original-margin-width) + (setq right-margin-width flymake--original-margin-width))) (t (if (eq flymake-margin-indicator-position 'left-margin) - (setq-local flymake--original-margin-width left-margin-width - left-margin-width 2) - (setq-local flymake--original-margin-width right-margin-width - right-margin-width 2)))) + (setq flymake--original-margin-width left-margin-width + left-margin-width 2) + (setq flymake--original-margin-width right-margin-width + right-margin-width 2)))) ;; Apply margin to all windows available. (mapc (lambda (x) (set-window-buffer x (window-buffer x))) @@ -1895,8 +1895,7 @@ correctly.") (let ((map (make-sparse-keymap))) ;; BEWARE: `mouse-wheel-UP-event' corresponds to `wheel-DOWN' events ;; and vice versa!! - (with-suppressed-warnings - ((obsolete mouse-wheel-up-event mouse-wheel-down-event)) + (with-no-warnings (define-key map (vector 'mode-line mouse-wheel-down-event) #'flymake--mode-line-counter-scroll-prev) (define-key map [mode-line wheel-down]