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): New. (flymake--mode-line-counter): Use new keymap and include 'flymake--diagnostic-type' as a property in the mode-line. (Bug#64428)
This commit is contained in:
parent
488dc24d2a
commit
e5be6c7ae3
1 changed files with 32 additions and 15 deletions
|
@ -1568,6 +1568,36 @@ correctly.")
|
||||||
(defun flymake--mode-line-counters ()
|
(defun flymake--mode-line-counters ()
|
||||||
(when (flymake-running-backends) flymake-mode-line-counter-format))
|
(when (flymake-running-backends) flymake-mode-line-counter-format))
|
||||||
|
|
||||||
|
(defun flymake--mode-line-counter-scroll-prev (event)
|
||||||
|
(interactive "e")
|
||||||
|
(let* ((event-start (event-start event))
|
||||||
|
(posn-string (posn-string event-start))
|
||||||
|
(type (get-text-property
|
||||||
|
(cdr posn-string) 'flymake--diagnostic-type (car posn-string))))
|
||||||
|
(with-selected-window (posn-window event-start)
|
||||||
|
(flymake-goto-prev-error 1 (list type) t))))
|
||||||
|
|
||||||
|
(defun flymake--mode-line-counter-scroll-next (event)
|
||||||
|
(interactive "e")
|
||||||
|
(let* ((event-start (event-start event))
|
||||||
|
(posn-string (posn-string event-start))
|
||||||
|
(type (get-text-property
|
||||||
|
(cdr posn-string) 'flymake--diagnostic-type (car posn-string))))
|
||||||
|
(with-selected-window (posn-window event-start)
|
||||||
|
(flymake-goto-next-error 1 (list type) t))))
|
||||||
|
|
||||||
|
(defvar 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)
|
(defun flymake--mode-line-counter (type &optional no-space)
|
||||||
"Compute number of diagnostics in buffer with TYPE's severity.
|
"Compute number of diagnostics in buffer with TYPE's severity.
|
||||||
TYPE is usually keyword `:error', `:warning' or `:note'."
|
TYPE is usually keyword `:error', `:warning' or `:note'."
|
||||||
|
@ -1598,21 +1628,8 @@ TYPE is usually keyword `:error', `:warning' or `:note'."
|
||||||
((eq type :warning) "warnings")
|
((eq type :warning) "warnings")
|
||||||
((eq type :note) "notes")
|
((eq type :note) "notes")
|
||||||
(t (format "%s diagnostics" type))))
|
(t (format "%s diagnostics" type))))
|
||||||
keymap
|
flymake--diagnostic-type ,type
|
||||||
,(let ((map (make-sparse-keymap)))
|
keymap ,flymake--mode-line-counter-map)))))
|
||||||
(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))))))
|
|
||||||
|
|
||||||
;;; Per-buffer diagnostic listing
|
;;; Per-buffer diagnostic listing
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue