Subject: Re: bug#29272: 26.0.90; "C-h k C-mouse-3" followed by menu selection asks for more keys

From: Eli Zaretskii <[email-masked]>
Date: Wed, 29 Nov 2017 19:53:57 +0200

> From: Noam Postavsky <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],  [email-masked]
> Date: Wed, 29 Nov 2017 08:19:34 -0500
> 
> 
> The following works for me in lucid and gtk:
> 
> --- c/lisp/help.el
> +++ i/lisp/help.el
> @@ -726,19 +726,19 @@ help-read-key-sequence
>            (while
>                (pcase (setq key (read-key-sequence "\
>  Describe the following key, mouse click, or menu item: "))
> -                ((and (pred vectorp) (let `(,key0 . ,_) (aref key 0))
> -                      (guard (symbolp key0)) (let keyname (symbol-name key0)))
> -                 (or
> -                  (and no-mouse-movement
> -                       (string-match "mouse-movement" keyname))
> -                  (and (string-match "\\(mouse\\|down\\|click\\|drag\\)"
> -                                     keyname)
> -                       (progn
> -                         ;; Discard events (e.g. <help-echo>) which might
> -                         ;; spuriously trigger the `sit-for'.
> -                         (sleep-for 0.01)
> -                         (while (read-event nil nil 0.01))
> -                         (not (sit-for (/ double-click-time 1000.0) t))))))))
> +                (`[(,key0 . ,_)]
> +                 (or (and no-mouse-movement (eq key0 'mouse-movement))
> +                     ;; Wait long enough to fully read a double click event.
> +                     ;; FIXME: How to handle double-click-time = t?
> +                     (and (numberp double-click-time)
> +                          (string-match "\\(mouse\\|down\\|click\\|drag\\)"
> +                                        (symbol-name key0))
> +                          (progn
> +                            ;; Discard events (e.g. <help-echo>) which might
> +                            ;; spuriously trigger the `sit-for'.
> +                            (sleep-for 0.01)
> +                            (while (read-event nil nil 0.01))
> +                            (not (sit-for (/ double-click-time 1000.0) t))))))))
>            (list
>             key
>             ;; If KEY is a down-event, read and include the
> 

LGTM, thanks

> > BTW: Could someone please fix that
> >
> > (not (sit-for (/ double-click-time 1000.0) t))
> >
> > form so it handles at least those values of `double-click-time'
> > described in its documentation:
> >
> >   Maximum time between mouse clicks to make a double-click.
> >   Measured in milliseconds.  The value nil means disable double-click
> >   recognition; t means double-clicks have no time limit and are detected
> >   by position only.
> >
> > I'm not sure what `sit-for' is supposed to return in those cases.
> 
> I don't know how to handle the double-click-time = t case though.

I think we should use some fixed time in that case.