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.
This commit is contained in:
João Távora 2025-04-20 13:24:52 +01:00
parent 53d732d775
commit 77cd3a406b

View file

@ -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]