all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#64428: [PATCH] Fix flymake mode line scrolling with pixel-scroll-precision-mode
@ 2023-07-02 21:51 sbaugh
  2023-07-06  7:37 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: sbaugh @ 2023-07-02 21:51 UTC (permalink / raw)
  To: 64428

[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]

Tags: patch


This patch is based on the patch in bug#64425 (since I noticed this
unrelated issue while working on that, and they touch the same code).



When pixel-scroll-precision-mode is enabled, scrolling the mouse wheel
will yield wheel-{up,down} events.  flymake now binds the new events
in addition to the old mouse-wheel-{up,down}-event.

* lisp/progmodes/flymake.el:(flymake--mode-line-counter-scroll-prev,
flymake--mode-line-counter-scroll-next,
flymake--mode-line-counter-map): Add.
(flymake--mode-line-counter): Use new keymap and include 'type as a
property in the mode-line.


In GNU Emacs 29.0.92 (build 8, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2023-07-02 built on earth
Repository revision: c361966508e2da159b5e65c37dff7f78e87b3445
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12101008
System Description: NixOS 23.05 (Stoat)

Configured using:
 'configure --with-x-toolkit=lucid --with-tree-sitter --with-xinput2'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-flymake-mode-line-scrolling-with-pixel-scroll-pr.patch --]
[-- Type: text/patch, Size: 3616 bytes --]

From ead790ca0525472ed52314b8bab67e7d246cda4e Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@catern.com>
Date: Sun, 2 Jul 2023 17:49:23 -0400
Subject: [PATCH] Fix flymake mode line scrolling with
 pixel-scroll-precision-mode

When pixel-scroll-precision-mode is enabled, scrolling the mouse wheel
will yield wheel-{up,down} events.  flymake now binds the new events
in addition to the old mouse-wheel-{up,down}-event.

* lisp/progmodes/flymake.el:(flymake--mode-line-counter-scroll-prev,
flymake--mode-line-counter-scroll-next,
flymake--mode-line-counter-map): Add.
(flymake--mode-line-counter): Use new keymap and include 'type as a
property in the mode-line.
---
 lisp/progmodes/flymake.el | 43 +++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 15 deletions(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 47dc32f9245..a424b0b6c8d 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1449,6 +1449,32 @@ flymake--mode-line-exception
 (defun flymake--mode-line-counters ()
   (when (flymake-running-backends) flymake-mode-line-counter-format))
 
+(defun flymake--mode-line-counter-scroll-prev (event)
+  (interactive "e")
+  (let* ((posn-string (posn-string (event-start event)))
+         (type (get-text-property (cdr posn-string) 'type (car posn-string))))
+    (with-selected-window (posn-window (event-start event))
+      (flymake-goto-prev-error 1 (list type) t))))
+
+(defun flymake--mode-line-counter-scroll-next (event)
+  (interactive "e")
+  (let* ((posn-string (posn-string (event-start event)))
+         (type (get-text-property (cdr posn-string) 'type (car posn-string))))
+    (with-selected-window (posn-window (event-start event))
+      (flymake-goto-next-error 1 (list type) t))))
+
+(setq flymake--mode-line-counter-map
+      (let ((map (make-sparse-keymap)))
+        (define-key map (vector 'mode-line mouse-wheel-down-event)
+                    #'flymake--mode-line-counter-scroll-prev)
+        (define-key map [mode-line wheel-down]
+                    #'flymake--mode-line-counter-scroll-prev)
+        (define-key map (vector 'mode-line mouse-wheel-up-event)
+                    #'flymake--mode-line-counter-scroll-next)
+        (define-key map [mode-line wheel-up]
+                    #'flymake--mode-line-counter-scroll-next)
+        map))
+
 (defun flymake--mode-line-counter (type &optional no-space)
   "Compute number of diagnostics in buffer with TYPE's severity.
 TYPE is usually keyword `:error', `:warning' or `:note'."
@@ -1479,21 +1505,8 @@ flymake--mode-line-counter
                              ((eq type :warning) "warnings")
                              ((eq type :note) "notes")
                              (t (format "%s diagnostics" type))))
-         keymap
-         ,(let ((map (make-sparse-keymap)))
-            (define-key map (vector 'mode-line
-                                    mouse-wheel-down-event)
-              (lambda (event)
-                (interactive "e")
-                (with-selected-window (posn-window (event-start event))
-                  (flymake-goto-prev-error 1 (list type) t))))
-            (define-key map (vector 'mode-line
-                                    mouse-wheel-up-event)
-              (lambda (event)
-                (interactive "e")
-                (with-selected-window (posn-window (event-start event))
-                  (flymake-goto-next-error 1 (list type) t))))
-            map))))))
+         type ,type
+         keymap ,flymake--mode-line-counter-map)))))
 
 ;;; Per-buffer diagnostic listing
 
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-07-13 14:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-02 21:51 bug#64428: [PATCH] Fix flymake mode line scrolling with pixel-scroll-precision-mode sbaugh
2023-07-06  7:37 ` Eli Zaretskii
2023-07-06 13:16   ` Spencer Baugh
2023-07-06 14:04     ` Eli Zaretskii
2023-07-07 11:37       ` João Távora
2023-07-07 11:47         ` João Távora
2023-07-07 12:12           ` sbaugh
2023-07-13  5:56             ` Eli Zaretskii
2023-07-13  8:12               ` João Távora
2023-07-13 14:00                 ` Eli Zaretskii
2023-07-07 12:52         ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.