GNU bug report logs - #15045
Point jumps inappropriately around time of Semantic lexing

Previous Next

Package: emacs;

Reported by: Barry OReilly <gundaetiapo <at> gmail.com>

Date: Wed, 7 Aug 2013 18:00:02 UTC

Severity: normal

Done: Barry OReilly <gundaetiapo <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Barry OReilly <gundaetiapo <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 15045 <at> debbugs.gnu.org, David Engster <deng <at> randomsample.de>, Eric Ludlam <eric <at> siege-engine.com>
Subject: bug#15045: Point jumps inappropriately around time of Semantic lexing
Date: Thu, 17 Oct 2013 14:18:56 -0400
> Here's the solution you requested. Let me know that it's good to
> install.

Looks fine.  See comments below.

> +       Change how input-pending-p checks for timers to run. Its default
> +       changes from checking to not checking. Its new check-timers param
> +       allows for prior behavior.

Good.
"Don't run timers in input-pending-p" would have sufficed.

> +** `(input-pending-p)' no longer runs other timers which are ready to
> +run. The new optional CHECK-TIMERS param allows for the prior behavior.

Please use 2 spaces after a full-stop (see sentence-end-double-space).

> +  return (get_input_pending ((EQ (check_timers, Qnil)

EQ (check_timers, Qnil)  =>  NILP (check_timers)

> +;;; timer-tests.el --- tests for timers -*- coding: utf-8;
> lexical-binding:t -*-

The "coding:utf-8" is redundant nowadays.

> +(require 'ert)

IIUC this `require' is also redundant.

> +(ert-deftest timer-tests-sit-for ()
> +  (let ((timer-ran nil)
> +        (timeout (time-add (current-time)
> +                           '(0 10 0 0)))
> +        ;; Want sit-for behavior when interactive
> +        (noninteractive nil))
> +    (run-at-time '(0 1 0 0)
> +                 nil
> +                 (lambda ()
> +                   (setq timer-ran t)))
> +    (while (not timer-ran)
> +        (should (time-less-p (current-time)
> +                             timeout))
> +        (sit-for 0 t))))

I think there's a race-condition, here:
- let's say we're at time < timeout.
- we run sit-for, which does not run the timer since we're still <timeout.
- time advances to > timeout.
- we check (should (time-less-p (current-time) timeout))
- we complain unjustly.

I.e. we should test, after running sit-for, that the "current time before
running sit-for" was < timeout.


        Stefan




This bug report was last modified 11 years and 193 days ago.

Previous Next


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