From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Repeating timers and suspending the computer Date: Fri, 09 Dec 2022 09:25:34 +0200 Message-ID: <834ju511jl.fsf@gnu.org> References: <87r0x9dug9.fsf@mbork.pl> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30544"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 09 08:27:06 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p3Xmj-0007nD-JP for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 09 Dec 2022 08:27:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3XmG-0004t1-Kf; Fri, 09 Dec 2022 02:26:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3XlX-0004g0-OA for help-gnu-emacs@gnu.org; Fri, 09 Dec 2022 02:25:55 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3XlX-0003S6-2L for help-gnu-emacs@gnu.org; Fri, 09 Dec 2022 02:25:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=E1c+r8QJZ4sesJBx0ygaVQGltCzLFTqAnG2hncB1WWs=; b=gYnyTdE3gRd8 aVEss4jOjsEB1Z5T6dXnx7GoJa6/uV74LFGr1CizhwquGlWp8ZEpoEJmrsEFV4LTqlLpcgkxOj7YB t0yexAh+JtDqmYKvSs+JdV5sS4Q7hr4xN4sgOWqGer6cx1lwRQgyg4nx8cllcyfdODnQIbfG5rPun 5w2G73wtxwNz9sOULyvYehlrF548SVW8Sitv5Jc/ATJhpvGIaE0N10rYvzUTKGWCoXdcBtLFPhC55 tJvp6CLDrqWf6w4/GqG4W3IWpssaH2CY6EQUjMxXRsqWc+Kv6HyTTKAuVnlY1Uvhkqr27hlPXJ1VJ wTgtP9LGSJUZ221Bk+DkFQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3XlQ-0006EM-9b for help-gnu-emacs@gnu.org; Fri, 09 Dec 2022 02:25:45 -0500 In-Reply-To: <87r0x9dug9.fsf@mbork.pl> (message from Marcin Borkowski on Fri, 09 Dec 2022 06:20:22 +0100) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:141499 Archived-At: > From: Marcin Borkowski > Date: Fri, 09 Dec 2022 06:20:22 +0100 > > assume that I said > > (run-with-timer 0 1 > (lambda () (message "%s" (format-time-string "%H:%M:%S.%3N")))) > > and put my laptop in the "sleep mode" for 20 seconds. How many time > messages should I get? Assume `timer-max-repeats' is 10 (which seems to > be the default). > > When I did the experiment, it seemed that the timer'd function was run > /twice/ after waking up, which looks really strange -- why two times? I think you have some implicit mental model of what happens when the number of delayed invocations of the timer function exceeds that limit, a model that you didn't describe. You seem to be assuming that you will get those 10 invocations, and no more, is that right? But that is not the only possible way of dealing with this situation. In fact, it isn't even smart: if time has jumped far ahead, why should Emacs give you 10 useless invocations of the timer? Or if you were expecting something else, please tell what you expected and why.