unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28732: flymake mouse-wheel portability fix
@ 2017-10-07 15:31 Charles A. Roelli
  2017-10-21 13:06 ` Charles A. Roelli
  2018-02-26 21:38 ` Glenn Morris
  0 siblings, 2 replies; 10+ messages in thread
From: Charles A. Roelli @ 2017-10-07 15:31 UTC (permalink / raw)
  To: 28732

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 "[")





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

* bug#28732: flymake mouse-wheel portability fix
  2017-10-07 15:31 bug#28732: flymake mouse-wheel portability fix Charles A. Roelli
@ 2017-10-21 13:06 ` Charles A. Roelli
  2018-02-26 21:38 ` Glenn Morris
  1 sibling, 0 replies; 10+ messages in thread
From: Charles A. Roelli @ 2017-10-21 13:06 UTC (permalink / raw)
  To: 28732-done

> Date: Sat, 07 Oct 2017 17:31:36 +0200
> From: charles@aurox.ch (Charles A. Roelli)
> 
> 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 "[")

It's pushed, closing.

  commit 75bb4827637111a210c79583f45dd1c5d59a745f
  Date:   Sat Oct 21 14:56:59 2017 +0200

  Make flymake's mouse-wheel interaction portable (Bug#28732)

  * lisp/progmodes/flymake.el (flymake--mode-line-format): Bind
  'mouse-wheel-down-event' and 'mouse-wheel-up-event' instead of
  'mouse-4' and 'mouse-5'.  Update the tooltip text accordingly, and
  remove a stray newline in it.






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

* bug#28732: flymake mouse-wheel portability fix
  2017-10-07 15:31 bug#28732: flymake mouse-wheel portability fix Charles A. Roelli
  2017-10-21 13:06 ` Charles A. Roelli
@ 2018-02-26 21:38 ` Glenn Morris
  2018-02-27 19:28   ` Charles A. Roelli
  1 sibling, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2018-02-26 21:38 UTC (permalink / raw)
  To: Charles A. Roelli; +Cc: 28732


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 "[")





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

* bug#28732: flymake mouse-wheel portability fix
  2018-02-26 21:38 ` Glenn Morris
@ 2018-02-27 19:28   ` Charles A. Roelli
  2018-02-27 19:31     ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Charles A. Roelli @ 2018-02-27 19:28 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 28732

> 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 "[")





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

* bug#28732: flymake mouse-wheel portability fix
  2018-02-27 19:28   ` Charles A. Roelli
@ 2018-02-27 19:31     ` Eli Zaretskii
  2018-02-28 19:02       ` Charles A. Roelli
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2018-02-27 19:31 UTC (permalink / raw)
  To: Charles A. Roelli; +Cc: 28732

> Date: Tue, 27 Feb 2018 20:28:42 +0100
> From: charles@aurox.ch (Charles A. Roelli)
> Cc: 28732@debbugs.gnu.org
> 
> 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))

Is there any reason you cannot simply require mwheel in flymake?  Or
does loading mwheel in a --without-x build fail?





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

* bug#28732: flymake mouse-wheel portability fix
  2018-02-27 19:31     ` Eli Zaretskii
@ 2018-02-28 19:02       ` Charles A. Roelli
  2018-02-28 20:32         ` Eli Zaretskii
  2018-03-02  2:10         ` Noam Postavsky
  0 siblings, 2 replies; 10+ messages in thread
From: Charles A. Roelli @ 2018-02-28 19:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 28732

> Date: Tue, 27 Feb 2018 21:31:33 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > Date: Tue, 27 Feb 2018 20:28:42 +0100
> > From: charles@aurox.ch (Charles A. Roelli)
> > Cc: 28732@debbugs.gnu.org
> > 
> > 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))
> 
> Is there any reason you cannot simply require mwheel in flymake?  Or
> does loading mwheel in a --without-x build fail?

Good point.  Can someone with a "--without-x" build handy check that?
"mwheel.elc" is in src/lisp.mk, so it confuses me that it would not be
immediately available.





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

* bug#28732: flymake mouse-wheel portability fix
  2018-02-28 19:02       ` Charles A. Roelli
@ 2018-02-28 20:32         ` Eli Zaretskii
  2018-03-01 19:43           ` Charles A. Roelli
  2018-03-02  2:10         ` Noam Postavsky
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2018-02-28 20:32 UTC (permalink / raw)
  To: Charles A. Roelli; +Cc: 28732

> Date: Wed, 28 Feb 2018 20:02:22 +0100
> From: charles@aurox.ch (Charles A. Roelli)
> CC: rgm@gnu.org, 28732@debbugs.gnu.org
> 
> "mwheel.elc" is in src/lisp.mk, so it confuses me that it would not be
> immediately available.

You will see in loadup.el that it is not preloaded in --without-x
builds.





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

* bug#28732: flymake mouse-wheel portability fix
  2018-02-28 20:32         ` Eli Zaretskii
@ 2018-03-01 19:43           ` Charles A. Roelli
  0 siblings, 0 replies; 10+ messages in thread
From: Charles A. Roelli @ 2018-03-01 19:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 28732

> > "mwheel.elc" is in src/lisp.mk, so it confuses me that it would not be
> > immediately available.
> 
> You will see in loadup.el that it is not preloaded in --without-x
> builds.

Thanks.  As you suggested, explicitly requiring `mwheel' is probably
the best solution then.





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

* bug#28732: flymake mouse-wheel portability fix
  2018-02-28 19:02       ` Charles A. Roelli
  2018-02-28 20:32         ` Eli Zaretskii
@ 2018-03-02  2:10         ` Noam Postavsky
  2018-03-03 10:43           ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Noam Postavsky @ 2018-03-02  2:10 UTC (permalink / raw)
  To: Charles A. Roelli; +Cc: 28732

charles@aurox.ch (Charles A. Roelli) writes:

>> Is there any reason you cannot simply require mwheel in flymake?  Or
>> does loading mwheel in a --without-x build fail?
>
> Good point.  Can someone with a "--without-x" build handy check that?
> "mwheel.elc" is in src/lisp.mk, so it confuses me that it would not be
> immediately available.

mwheel loads without errors for me in a --without-x build.





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

* bug#28732: flymake mouse-wheel portability fix
  2018-03-02  2:10         ` Noam Postavsky
@ 2018-03-03 10:43           ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-03-03 10:43 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: charles, 28732

> From: Noam Postavsky <npostavs@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  rgm@gnu.org,  28732@debbugs.gnu.org
> Date: Thu, 01 Mar 2018 21:10:50 -0500
> 
> charles@aurox.ch (Charles A. Roelli) writes:
> 
> >> Is there any reason you cannot simply require mwheel in flymake?  Or
> >> does loading mwheel in a --without-x build fail?
> >
> > Good point.  Can someone with a "--without-x" build handy check that?
> > "mwheel.elc" is in src/lisp.mk, so it confuses me that it would not be
> > immediately available.
> 
> mwheel loads without errors for me in a --without-x build.

Thanks, I pushed the required change.





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

end of thread, other threads:[~2018-03-03 10:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-07 15:31 bug#28732: flymake mouse-wheel portability fix Charles A. Roelli
2017-10-21 13:06 ` Charles A. Roelli
2018-02-26 21:38 ` Glenn Morris
2018-02-27 19:28   ` Charles A. Roelli
2018-02-27 19:31     ` Eli Zaretskii
2018-02-28 19:02       ` Charles A. Roelli
2018-02-28 20:32         ` Eli Zaretskii
2018-03-01 19:43           ` Charles A. Roelli
2018-03-02  2:10         ` Noam Postavsky
2018-03-03 10:43           ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).