[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Function write-region resets idle time
From: |
Cecil Westerhof |
Subject: |
Re: Function write-region resets idle time |
Date: |
Thu, 11 Jan 2018 20:38:17 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Cecil Westerhof <Cecil@decebal.nl> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Cecil Westerhof <Cecil@decebal.nl>
>>> Date: Thu, 11 Jan 2018 18:43:53 +0100
>>>
>>> I found a strange problem: write-region resets idle-time. But only
>>> after the calling function has returned.
>>
>> ??? Any Lisp you run resets idle-time. Idleness starts when Emacs
>> gets to its command loop and finds that there's no pending input. It
>> ends when there's some input event that causes the command loop to run
>> the Lisp interpreter. In your case, the input event is supplied by
>> the timer you set up.
>>
>> So why is what you discovered surprising, let alone a problem? Am I
>> missing something?
>
> The definition of idle:
> Emacs becomes idle when it starts waiting for user input, and it
> remains idle until the user provides some input. If a timer is set
> for five seconds of idleness, it runs approximately five seconds
> after Emacs first becomes idle.
>
> And to make it even more clear:
> Even if repeat is non-nil, this timer will not run again as long
> as Emacs remains idle, because the duration of idleness will
> continue to increase and will not go down to five seconds again.
>
> So the running of the function should NOT reset idle time.
>
>
> The behaviour changed (for me) on the 19th of December.
>
> And if what you say would be true: then there should be also no
> difference if my function uses write-region or not. But there is.
> Without write-region idle time is NOT reset. With write-region
> idle-time IS reset.
>
> I certainly find it surprising that write-region does something else
> as all other functions with idle time.
And to make it even more clear, I defined:
(defun only-message ()
(message (format "Only message: %s %s" (current-time)
(current-idle-time)))
)
And when I use:
(setq timer-object (run-with-timer 30 30 'only-message))
I get:
Only message: (23127 48054 400127 610000) (0 29 996735 28000)
Only message: (23127 48084 396995 23000) (0 59 993602 312000)
Only message: (23127 48114 400137 106000) (0 89 996744 686000)
Only message: (23127 48144 400100 220000) (0 119 996707 561000)
Only message: (23127 48174 400122 394000) (0 149 996729 864000)
So again, ONLY calling write-region does rest idle time.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
Re: Function write-region resets idle time, Cecil Westerhof, 2018/01/12