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: Tue, 13 Dec 2022 14:32:12 +0200 Message-ID: <83pmcnpjqr.fsf@gnu.org> References: <87r0x9dug9.fsf@mbork.pl> <834ju511jl.fsf@gnu.org> <87ilijdjls.fsf@mbork.pl> <83pmcqv3dm.fsf@gnu.org> <87zgbrdgsa.fsf@mbork.pl> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39535"; 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 Tue Dec 13 13:32:56 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 1p54Su-0009zn-M3 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 13 Dec 2022 13:32:56 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p54SE-0007Yi-Ki; Tue, 13 Dec 2022 07:32:14 -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 1p54SC-0007X6-ED for help-gnu-emacs@gnu.org; Tue, 13 Dec 2022 07:32:12 -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 1p54SC-0005IV-6L for help-gnu-emacs@gnu.org; Tue, 13 Dec 2022 07:32:12 -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=iQn8qEhzAqRcF1NxM2uvIofiyk9AV5jxqS3tk1M0u7k=; b=HM5xWHuxxOP7 MbpKgDTdTRewvWpNPQyoh+6OqdL2UMTMywIRUHFnT71KN+gjq6zxRBm411JEkcbg3D8T0K6WUBhL5 KV/UIu5jzaDTDbb+Dnsap9xG60fnwRuXO3Mv1ma7TfULIwQPgVBEMwNRGn/6VCqjy4ubE6wY4opPx uxJ5o0FKHqGST/JBIQ5OtH2JRO6sFfbYwhirTq6MHlDmMh7y44pAIiJnW7qGYBoJQXOtHbROhx4p9 c/MnNYAzl0KS6QNLo6h1tZPmGNuEUxCwyL9ngx7pl+ae+q/7VmeWmzRlOKUofg+8mWOfLBowJtMpB /UNSTrkcVimd9v9hgrX60w==; 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 1p54S8-0008UQ-1V for help-gnu-emacs@gnu.org; Tue, 13 Dec 2022 07:32:12 -0500 In-Reply-To: <87zgbrdgsa.fsf@mbork.pl> (message from Marcin Borkowski on Tue, 13 Dec 2022 06:16:53 +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:141710 Archived-At: > From: Marcin Borkowski > Cc: help-gnu-emacs@gnu.org > Date: Tue, 13 Dec 2022 06:16:53 +0100 > > ;; If real time has jumped forward, > ;; perhaps because Emacs was suspended for a long time, > ;; limit how many times things get repeated. > (if (and (numberp timer-max-repeats) > (time-less-p (timer--time timer) nil)) > (let ((repeats (/ (timer-until timer nil) > (timer--repeat-delay timer)))) > (if (> repeats timer-max-repeats) > (timer-inc-time timer (* (timer--repeat-delay timer) > repeats))))) > --8<---------------cut here---------------end--------------->8--- > > Do I get it correctly that this means that of the scheduled number of > repeats is /less/ than `timer-max-repeats', then all of them get > executed, but when it is greater than that, only one of them is? That's the idea, yes.