bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64428: [PATCH] Fix flymake mode line scrolling with pixel-scroll-pre


From: João Távora
Subject: bug#64428: [PATCH] Fix flymake mode line scrolling with pixel-scroll-precision-mode
Date: Fri, 7 Jul 2023 12:47:10 +0100

On second thought, here are some comments that I think should be
improved in Spencer's patch:

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

Spencer, here you are recording the value of the `type` in a `type`
text-property of the affected text.  Generally, though this rule
isn't enforced or always followed (at least by me), it's better
to give these package-specific properties some longer
package-specific name like `flymake--diagnostic-type`.  This will
prevent any clashes if the less-qualified `type` is ever defined
to mean something else as a text-property.

> +  (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))))

And here, you could consider saving the value of (event-start event)
by adding another early binding to that `let*`, maybe call it `estart`.
This is much less important than the first comment though.

João





reply via email to

[Prev in Thread] Current Thread [Next in Thread]