* idle-timer clock gets reset upon subprocess output.
@ 2002-06-23 1:15 D. Goel
2002-06-23 1:18 ` D. Goel
2002-06-27 16:45 ` Richard Stallman
0 siblings, 2 replies; 4+ messages in thread
From: D. Goel @ 2002-06-23 1:15 UTC (permalink / raw)
;; BUG: i think: idle-timer clock gets reset upon subprocess output.
;; =================================================================
;; The example in this file displays a bug in idle-timers. I have
;; observed this bug with all sorts of (a)synchronous processes like
;; those occurring in eshell, ERC etc.
;; Basically, the manual says:
;; ,----
;; | ; Emacs can do various things while idle: garbage collect, autosave
;; | ;or handle data from a subprocess. But these interludes during
;; | ;idleness do not interfere with idle timers, because they do not reset
;; | ;the clock of idleness to zero. An idle timer set for 600 seconds
;; | ;will run when ten minutes have elapsed since the last user command
;; | ;was finished, even if subprocess output has been accepted thousands
;; | ;of times within those ten minutes, even if there have been garbage
;; | ;collections and autosaves.
;; `----
;; However, it seems that the clock does get reset every time a
;; subprocess output results.. I have tested this on emacs21.1 on
;; a dec_alpha.
;; The function below sets up a 7-second timer, and displays the
;; current time. And then runs a background process which returns
;; output in 5 seconds. After the 7-second timer is run, the
;; current-time is displayed again. The difference between the two
;; displayed times should be 7 seconds, but it is 12 seconds (= 7 +
;; 5).. IMHO, what happens is that when the process results in an
;; output, the timer-clock gets reset. Am i misinterpreting things?
;; Save this file to ~/.emacs.timer and do an
;; emacs21 -q -no-site-file -l ~/.emacs.timer
;; M-x test-timer
(defun test-timer ()
(interactive)
;; get done with dummy stuff and distracting messages
(require 'eshell)
(require 'timer)
(eshell)
(message "Starting stuff..")
(switch-to-buffer "*eshell*")
(goto-char (point-max))
(insert "echo Dummy input..")
(eshell-send-input)
;; done with irrelevant messages...
;; Start a 7-second timer... (which should show time after 7
;; seconds... however, it will actually show time after 12 seconds..)
(run-with-idle-timer 7 nil
'(lambda () (interactive)
(message
(format-time-string
"7 seconds reached, at %H:%M::%S"))))
;; echo the current time...
(message (format-time-string "Seven-second timer started at: %H:%M::%S"))
(switch-to-buffer "*eshell*")
(goto-char (point-max))
(insert "sleep 5")
(eshell-send-input))
====================================================
bug-header: -->
In GNU Emacs 21.1.3 (alphaev56-dec-osf4.0f, X toolkit, Xaw3d scroll bars)
of 2001-10-30 on shorty.csc.umd.edu
configured using `configure --prefix=/usr/local/gnu --infodir=/usr/local/gnu/info/emacs-21.1 --with-kerberos --with-x --with-x-toolkit=yes --with-xpm --with-jpeg --with-tiff --with-gif --with-png'
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: nil
locale-coding-system: nil
default-enable-multibyte-characters: t
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: idle-timer clock gets reset upon subprocess output.
2002-06-23 1:15 idle-timer clock gets reset upon subprocess output D. Goel
@ 2002-06-23 1:18 ` D. Goel
2002-06-27 16:45 ` Richard Stallman
1 sibling, 0 replies; 4+ messages in thread
From: D. Goel @ 2002-06-23 1:18 UTC (permalink / raw)
> ;; observed this bug with all sorts of (a)synchronous processes like
I meant: asynchronous processes
viz. no () around a.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: idle-timer clock gets reset upon subprocess output.
2002-06-23 1:15 idle-timer clock gets reset upon subprocess output D. Goel
2002-06-23 1:18 ` D. Goel
@ 2002-06-27 16:45 ` Richard Stallman
2002-07-04 6:15 ` D. Goel
1 sibling, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2002-06-27 16:45 UTC (permalink / raw)
Cc: emacs-devel
I think I have fixed it. Please try this fix.
*** keyboard.c.~1.683.~ Tue Jun 18 04:21:20 2002
--- keyboard.c Thu Jun 27 08:41:32 2002
***************
*** 664,669 ****
--- 664,674 ----
static EMACS_TIME timer_idleness_start_time;
+ /* After Emacs stops being idle, this saves the last value
+ of timer_idleness_start_time from when it was idle. */
+
+ static EMACS_TIME timer_last_idleness_start_time;
+
\f
/* Global variable declarations. */
***************
*** 3999,4004 ****
--- 4004,4011 ----
EMACS_GET_TIME (timer_idleness_start_time);
+ timer_last_idleness_start_time = timer_idleness_start_time;
+
/* Mark all idle-time timers as once again candidates for running. */
for (timers = Vtimer_idle_list; CONSP (timers); timers = XCDR (timers))
{
***************
*** 8332,8337 ****
--- 8339,8351 ----
keymap may have changed, so replay the sequence. */
if (BUFFERP (key))
{
+ EMACS_TIME initial_idleness_start_time
+ = timer_last_idleness_start_time;
+
+ /* Resume idle state, using the same start-time as before. */
+ timer_start_idle ();
+ timer_idleness_start_time = initial_idleness_start_time;
+
mock_input = t;
/* Reset the current buffer from the selected window
in case something changed the former and not the latter.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-07-04 6:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-23 1:15 idle-timer clock gets reset upon subprocess output D. Goel
2002-06-23 1:18 ` D. Goel
2002-06-27 16:45 ` Richard Stallman
2002-07-04 6:15 ` D. Goel
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.