From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: steve-humphreys@gmx.com Newsgroups: gmane.emacs.help Subject: Re: Elisp - Function returning a sequence of times Date: Wed, 16 Dec 2020 10:40:01 +0100 Message-ID: References: <878s9y8fy5.fsf@zoho.eu> <87ft46yubf.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34242"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Joost Kremers Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 16 10:40:35 2020 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 1kpTIQ-0008mT-Fd for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 10:40:34 +0100 Original-Received: from localhost ([::1]:33780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpTIP-0008Ay-Hk for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 04:40:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpTI0-000898-C1 for help-gnu-emacs@gnu.org; Wed, 16 Dec 2020 04:40:08 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]:43705) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpTHx-0008Vz-KN for help-gnu-emacs@gnu.org; Wed, 16 Dec 2020 04:40:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1608111601; bh=z7sKKRxRGoQs63OJ/ekhDAfH95PzwSg0TnRFAr6mB00=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=GdAp/z6cRyZbfaFxn5UC8usztixkSsGwrPiwRqSF7zr3dArOszSt53HK5gp0BYTR3 16djj2w1n15zLxhaxAOc62K6SfmAcDgQ9+4+lyec8gEF4zjtmm+p2sF6IOEsGbHRiQ rj/DPw0skN1S6EzShlP47Ag+M/2DqCW5eeQGsJjg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs15.server.lan [172.19.170.183]) (via HTTP); Wed, 16 Dec 2020 10:40:01 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <87ft46yubf.fsf@fastmail.fm> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:8kSbFXPrmWJ4QQcu3KAh1K17knoLSBckGRc7P78nT58/d5LEugupKkHKyMlEjX5LBjwJy zo1zwD1EBtGm8CoLWAwSwCXpFC1V47GXuqPl/Tn6SNaL8FVBgn6bJkCrMfy//WokS0GMpkxQ2HV8 eVyhkw/u/bI8dvuYlw3wZexe5lqZKFkS1THuLw4vmbM7YWKEd3XZnp/DktQhMG1Q2e3mluIlLhLy s+rShHAaVGthCS+14B3LRFkyiHRBszS6nh1tW2gRCs201jc5nvm45VEA7P9mSsuBNflBvsA5BIuh mY= X-UI-Out-Filterresults: notjunk:1;V03:K0:1gUCO0C6nyM=:5xJNR2FdD5IIIKYznXvwJl MP51HrOGhtxKDNbYemIDrrJr607NsBABr1m/bam/+7tai8y8K/PhGKEW3eZCgw6cyRGJ76SoX JfzoxIQ6KBVpd01KzcXDxCiBgpgvVsEQrvT9kiT6s8EcKCXI0RQ/xwF/1JPfuzjsGyh6wSylx 8R9QXbgQwUnfCsHANBQsNy3pJDVZkowX80ttCXQzMZN75J06KUfLb4n6GIUJLQpkXL6fCcFiG ELBpRVa/oh7AIlw4bHMqArNQ/R0R2VbNu0hxAVf2E83oovX7dOVXz6tA93VCY1JcaKT/UhDkF zxlMFYtrgja6xnipt5Pnq4rcJl4uMtRG3xeOZyATiiY64omM2AcZle32T7z7iQfCPG5f/MCoy ctIsszQMmchkkJCWIyz9sIl4CvMeNl9hhaRiE/fy0vwguOMvLee2+zltkgXmVYBEPk51cv+i0 s1nY2Ewsk8qtn4srfV+6T3ul0AwTwH8KBQYI7ZBQ/wGFsMckqVDBwwGvESEepUGip2iahV9xJ QuQiYnf6hPdnVdH2hhJJ/RZovondkNcrCJA8TqFGpaRD2KT6wqBF6feLcaImM5ddcoOYT9AQz ekbXK0MZ7uIBk= Received-SPF: pass client-ip=212.227.17.20; envelope-from=steve-humphreys@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.help:126416 Archived-At: Just made it quick, the focus is on the calculation for the new time. > Sent: Wednesday, December 16, 2020 at 10:20 AM > From: "Joost Kremers" > To: steve-humphreys@gmx.com > Cc: help-gnu-emacs@gnu.org > Subject: Re: Elisp - Function returning a sequence of times > > > On Wed, Dec 16 2020, steve-humphreys@gmx.com wrote: > > I have done something like this, but need help to finalise the actual = function. > > Do you agree on this solution? > > > > > > (defun timfutur () > > (interactive) > > (setq tm 845) > > (setq tsk 30) > > (setq thr (/ tm 100)) > > (setq tmn (- tm (* thr 100))) > > (setq tmn-futur (% (+ tmn tsk) 60)) > > (setq thr-futur (% (+ (/ (+ tmn tsk) 60) thr) 24)) > > (message "%d %d %d%d" thr tmn thr-futur tmn-futur)) > > My humble opinion: try to avoid `setq` at all cost. It has some legitima= te uses, > but they're far and few between. > > ``` > (defun timfutur () > (interactive) > (let* ((tm 845) > (tsk 30) > (thr (/ tm 100)) > (tmn (- tm (* thr 100))) > (tmn-futur (% (+ tmn tsk) 60)) > (thr-futur (% (+ (/ (+ tmn tsk) 60) thr) 24))) > (message "%d %d %d%d" thr tmn thr-futur tmn-futur))) > ``` > > -- > Joost Kremers > Life has its moments > >