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

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

bug#28732: flymake mouse-wheel portability fix


From: Charles A. Roelli
Subject: bug#28732: flymake mouse-wheel portability fix
Date: Tue, 27 Feb 2018 20:28:42 +0100

> From: Glenn Morris <rgm@gnu.org>
> Cc: 28732@debbugs.gnu.org
> Date: Mon, 26 Feb 2018 16:38:50 -0500
> 
> Hi,
> 
> This change causes errors in without-x builds.
> At compile-time:
>     
>     In flymake--mode-line-format:
>     progmodes/flymake.el:1086:49:Warning: reference to free variable
>         `mouse-wheel-down-event'
>     progmodes/flymake.el:1092:49:Warning: reference to free variable
>         `mouse-wheel-up-event'
> 
> At run-time:
>    Error during redisplay: (eval (flymake--mode-line-format)) signaled
>    (void-variable mouse-wheel-down-event)
> 
> 
> Charles A. Roelli wrote:
> 
> > The flymake mode line mouse-wheel scroll thing needs the following fix
> > to be more portable.
> >
> > This change also removes an extra newline at the end of the tooltip,
> > which doesn't have to be there as far as I can see.
> >
> > diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
> > index 45f0adf..007de8f 100644
> > --- a/lisp/progmodes/flymake.el
> > +++ b/lisp/progmodes/flymake.el
> > @@ -951,11 +951,13 @@ flymake--mode-line-format
> >                       keymap
> >                       ,(let ((map (make-sparse-keymap))
> >                              (type type))
> > -                        (define-key map [mode-line mouse-4]
> > +                        (define-key map (vector 'mode-line
> > +                                                mouse-wheel-down-event)
> >                            (lambda (_event)
> >                              (interactive "e")
> >                              (flymake-goto-prev-error 1 (list type) t)))
> > -                        (define-key map [mode-line mouse-5]
> > +                        (define-key map (vector 'mode-line
> > +                                                mouse-wheel-up-event)
> >                            (lambda (_event)
> >                              (interactive "e")
> >                              (flymake-goto-next-error 1 (list type) t)))
> > @@ -967,7 +969,9 @@ flymake--mode-line-format
> >                                                    'face face)
> >                                        (propertize (format "%s" type)
> >                                                    'face face))
> > -                              "mouse-4/mouse-5: previous/next of this 
> > type\n"))
> > +                              (format "%s/%s: previous/next of this type"
> > +                                      mouse-wheel-down-event
> > +                                      mouse-wheel-up-event)))
> >             into forms
> >             finally return
> >             `((:propertize "[")
> 

Thanks.  Is the following change (ignoring whitespace differences)
good for emacs-26?

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 58bad8f..d58c5943 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1078,7 +1078,9 @@
                      face ,face
                      mouse-face mode-line-highlight
                      keymap
-                     ,(let ((map (make-sparse-keymap))
+                     ,(when (and (boundp 'mouse-wheel-down-event)
+                                 (boundp 'mouse-wheel-up-event))
+                        (let ((map (make-sparse-keymap))
                             (type type))
                         (define-key map (vector 'mode-line
                                                 mouse-wheel-down-event)
@@ -1092,9 +1094,11 @@
                             (interactive "e")
                             (with-selected-window (posn-window (event-start 
event))
                               (flymake-goto-next-error 1 (list type) t))))
-                        map)
+                          map))
                      help-echo
-                     ,(concat (format "%s diagnostics of type %s\n"
+                     ,(when (and (boundp 'mouse-wheel-down-event)
+                                 (boundp 'mouse-wheel-up-event))
+                        (concat (format "%s diagnostics of type %s\n"
                                       (propertize (format "%d"
                                                           (length diags))
                                                   'face face)
@@ -1102,7 +1106,7 @@
                                                   'face face))
                               (format "%s/%s: previous/next of this type"
                                       mouse-wheel-down-event
-                                      mouse-wheel-up-event)))
+                                        mouse-wheel-up-event))))
            into forms
            finally return
            `((:propertize "[")





reply via email to

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