[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Function write-region resets idle time
From: |
Cecil Westerhof |
Subject: |
Function write-region resets idle time |
Date: |
Thu, 11 Jan 2018 18:43:53 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
I found a strange problem: write-region resets idle-time. But only
after the calling function has returned.
I defined the following functions:
(defun write-region-problem ()
(message (format "Before: %s %s" (current-time) (current-idle-time)))
(write-region "Just a test\n" nil "~/problem.log" t 0)
(message (format "After: %s %s" (current-time) (current-idle-time)))
)
(defun write-region-problem-loop ()
(dotimes (i 5)
(sleep-for 15)
(write-region-problem)))
When using:
(run-with-idle-timer 30 nil 'write-region-problem-loop)
I get:
Before: (23127 39556 376787 939000) (0 45 6316 747000)
After: (23127 39556 426254 575000) (0 45 55783 245000)
Before: (23127 39571 427804 974000) (0 60 57334 626000)
After: (23127 39571 469158 56000) (0 60 98686 884000)
Before: (23127 39586 472115 145000) (0 75 101644 158000)
After: (23127 39586 519021 983000) (0 75 148550 571000)
Before: (23127 39601 522126 756000) (0 90 151656 293000)
After: (23127 39601 570429 201000) (0 90 199958 257000)
Before: (23127 39616 573897 68000) (0 105 203426 556000)
After: (23127 39616 620647 371000) (0 105 250175 854000)
So everything seems to be OK.
But when using:
(setq timer-object (run-with-timer 30 30 'write-region-problem))
I get:
Before: (23127 39977 941713 503000) (0 29 994274 462000)
After: (23127 39977 982179 647000) (0 30 34741 483000)
Before: (23127 40007 940217 421000) (0 29 946739 305000)
After: (23127 40007 981669 405000) (0 29 988192 219000)
Before: (23127 40037 941670 105000) (0 29 944688 557000)
After: (23127 40037 991646 30000) (0 29 994665 603000)
Before: (23127 40067 941685 17000) (0 29 938036 13000)
After: (23127 40067 992876 336000) (0 29 989228 329000)
Before: (23127 40097 939595 311000) (0 29 936576 788000)
After: (23127 40097 977542 689000) (0 29 974525 333000)
So clearly write-region resets idle time.
In the past it was no problem at all. But at a certain point the
functionality changed. I do not know when, because I had for some time
problems with my gnus idle daemon, but I only now found out what the
problem is.
The version of Emacs I am using:
"GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2017-09-12 on hullmann, modified by Debian"
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
- Function write-region resets idle time,
Cecil Westerhof <=
Re: Function write-region resets idle time, Cecil Westerhof, 2018/01/12