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

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

bug#15045: Point jumps inappropriately around time of Semantic lexing


From: Stefan Monnier
Subject: bug#15045: Point jumps inappropriately around time of Semantic lexing
Date: Thu, 17 Oct 2013 14:18:56 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> 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





reply via email to

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