GNU bug report logs - #12326
24.2.50; js2-mode freezes on current trunk

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Sat, 1 Sep 2012 22:00:02 UTC

Severity: normal

Merged with 12447

Found in versions 24.1.50, 24.2.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: 12326 <at> debbugs.gnu.org
Subject: bug#12326: (24.2.50; js2-mode freezes on current trunk)
Date: Sun, 02 Sep 2012 05:41:58 +0400
Some further analysis showed that the freeze is caused by the infinite 
mutual loop between `js2-do-parse' and `js2-mode-reset-timer'.
Looks like it goes like this:

1. I enter some input.
2. js2-mode-edit is called; it calls js2-mode-reset-timer
3. js2-mode-reset-timer schedules js2-mode-idle-reparse to run
4. js2-mode-idle-reparse calls js2-do-parse
5. If I manage to press a button while js2-do-parse is still running, 
and it reaches an (input-pending-p), it stops parsing and calls 
js2-mode-reset-timer.
6. Apparently, at this point the timer code still thinks we're idle, 
because it immediately calls js2-mode-idle-reparse. So goto 4. While 
(input-pending-p) still returns true.

If I manually inline `run-with-idle-timer' into `js2-mode-reset-timer' 
and change the DONT-WAIT `timer-activate-when-idle' argument to nil, it 
fixes the problem. Like this:

(defun js2-mode-reset-timer ()
  "Cancel any existing parse timer and schedule a new one."
  (if js2-mode-parse-timer
      (cancel-timer js2-mode-parse-timer))
  (setq js2-mode-parsing nil)
  (let ((timer (timer-create)))
    (setq js2-mode-parse-timer timer)
    (timer-set-function timer 'js2-mode-idle-reparse (list 
(current-buffer)))
    (timer-set-idle-time timer js2-idle-timer-delay)
    (timer-activate-when-idle timer)))

Is this a problem in Emacs or consumer code?




This bug report was last modified 12 years and 248 days ago.

Previous Next


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