From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: gmane.emacs.help Subject: Re: Function write-region resets idle time Date: Thu, 11 Jan 2018 20:38:17 +0100 Organization: Decebal Computing Message-ID: <87fu7ci3ti.fsf@munus.decebal.nl> References: <87r2qw9tpi.fsf@munus.decebal.nl> <87a7xki4xk.fsf@munus.decebal.nl> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1515699835 4196 195.159.176.226 (11 Jan 2018 19:43:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 11 Jan 2018 19:43:55 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 11 20:43:51 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZilI-00007x-IF for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Jan 2018 20:43:40 +0100 Original-Received: from localhost ([::1]:37346 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZinH-0006pE-BP for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Jan 2018 14:45:43 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 64 Original-Injection-Info: reader02.eternal-september.org; posting-host="3ce06bae44728319efebd29f38d163ca"; logging-data="30528"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DNNAIxNl2K/vQ2Wa4yPn7GKLBPpnvlZ4=" Cancel-Lock: sha1:2onaAQCmRqxOdzuN/pSQOURls5s= sha1:kgQqaNZlnoVuvgw/wxukie0XZFg= Original-Xref: usenet.stanford.edu gnu.emacs.help:221543 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:115659 Archived-At: Cecil Westerhof writes: > Eli Zaretskii writes: > >>> From: Cecil Westerhof >>> 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