GNU bug report logs - #23419
25.0.93; double-click-time

Previous Next

Package: emacs;

Reported by: martin rudalics <rudalics <at> gmx.at>

Date: Mon, 2 May 2016 08:05:01 UTC

Severity: minor

Found in versions 25.0.93, 28.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23419 in the body.
You can then email your comments to 23419 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23419; Package emacs. (Mon, 02 May 2016 08:05:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 02 May 2016 08:05:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Bug-Gnu-Emacs <bug-gnu-emacs <at> gnu.org>
Subject: 25.0.93; double-click-time
Date: Mon, 02 May 2016 10:03:22 +0200
The documentation of ‘double-click-time’ is as:

  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.

However, most uses of ‘double-click-time’ in the lisp directory silently
assume that the value is a number which typically fails in ‘sit-for’s
like, for example, in help.el's

  (not (sit-for (/ double-click-time 1000.0) t))

when ‘double-click-time’ is either t or nil.

Could someone out there who understands the semantics of these
‘sit-for’s please fix them.  I can eventually do that myself but these
semantics are yet pretty unclear to me.

TIA, martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23419; Package emacs. (Sat, 15 Aug 2020 03:50:02 GMT) Full text and rfc822 format available.

Message #8 received at 23419 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 23419 <at> debbugs.gnu.org
Subject: Re: bug#23419: 25.0.93; double-click-time
Date: Fri, 14 Aug 2020 20:49:18 -0700
[Message part 1 (text/plain, inline)]
tags 23419 + patch
thanks

martin rudalics <rudalics <at> gmx.at> writes:

> The documentation of ‘double-click-time’ is as:
>
>   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.
>
> However, most uses of ‘double-click-time’ in the lisp directory silently
> assume that the value is a number which typically fails in ‘sit-for’s
> like, for example, in help.el's
>
>   (not (sit-for (/ double-click-time 1000.0) t))
>
> when ‘double-click-time’ is either t or nil.
>
> Could someone out there who understands the semantics of these
> ‘sit-for’s please fix them.  I can eventually do that myself but these
> semantics are yet pretty unclear to me.

I can confirm this.  To reproduce the issue in help.el, use:

0. emacs -Q
1. (setq double-click-time nil)
2. C-h k mouse-1

In the attached patch I add a new function `mouse-double-click-time'
which always returns a number.  This seems better than adding
specialized logic everywhere to handle the various cases.

Any comments?

Best regards,
Stefan Kangas
[0001-Fix-handling-double-click-time-nil-or-t-Bug-23419.patch (text/x-diff, attachment)]

Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sat, 15 Aug 2020 03:50:02 GMT) Full text and rfc822 format available.

bug Marked as found in versions 28.0.50. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sat, 15 Aug 2020 03:50:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23419; Package emacs. (Sat, 15 Aug 2020 07:02:01 GMT) Full text and rfc822 format available.

Message #15 received at 23419 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: rudalics <at> gmx.at, 23419 <at> debbugs.gnu.org
Subject: Re: bug#23419: 25.0.93; double-click-time
Date: Sat, 15 Aug 2020 10:01:34 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Fri, 14 Aug 2020 20:49:18 -0700
> Cc: 23419 <at> debbugs.gnu.org
> 
> In the attached patch I add a new function `mouse-double-click-time'
> which always returns a number.  This seems better than adding
> specialized logic everywhere to handle the various cases.

I don't see how this resolves the issue pointed out by Martin.  How do
we know that the problematic callers will DTRT with the arbitrary
values your function returns for t and nil?  Using a very large number
for t may be a good approximation (although I'm not even sure in that
case), but using zero for nil?

I'm afraid there's no way around auditing each caller and determining
what those non-numerical values mean in each case.  For example, I'd
actually suggest to avoid the call to sit-for in the nil case, because
a double-click will never be "on the way" in that case.

Thanks.




Removed tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sun, 16 Aug 2020 20:49:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23419; Package emacs. (Mon, 02 May 2022 10:05:01 GMT) Full text and rfc822 format available.

Message #20 received at 23419 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rudalics <at> gmx.at, Stefan Kangas <stefan <at> marxist.se>, 23419 <at> debbugs.gnu.org
Subject: Re: bug#23419: 25.0.93; double-click-time
Date: Mon, 02 May 2022 12:04:44 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> I'm afraid there's no way around auditing each caller and determining
> what those non-numerical values mean in each case.  For example, I'd
> actually suggest to avoid the call to sit-for in the nil case, because
> a double-click will never be "on the way" in that case.

I've gone through all the usage sites, and I think Stefan's patch is
correct -- they're using double-click-time as a sensible default for
what they're doing, but they're not really interested in the nil logic
(i.e., they're not supposed to be disabled in that case).

So I've now pushed Stefan's patch to Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 23419 <at> debbugs.gnu.org and martin rudalics <rudalics <at> gmx.at> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 02 May 2022 10:05:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 30 May 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.