From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id QIWIJWlGQ2ZoRwEAqHPOHw:P1 (envelope-from ) for ; Tue, 14 May 2024 13:09:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id QIWIJWlGQ2ZoRwEAqHPOHw (envelope-from ) for ; Tue, 14 May 2024 13:09:29 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1715684969; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2LOLb5epDESf93tSVt0lc/meUUTpZpIFlx1EQ+YeK1Q=; b=mNajIK3HUofpFHga4LjccTwYpoCGUm7ADU4ow0AEUZCsvJ+KMCU7c0o3XoYsr7XzmMzxod YpLTlIGXmAMUPOz31X7KP+L9aVW6rUaSnZSDfj1N2EPtAjDELsM+UIwUpCbeCRAi/ohy4f DBb8yfMDLa1vzjUx6E7TnTf6AAT0zNE5Zpq1pbcp10+2PqEW6k7WFKmZ1pN1kjdS/jv7Dm NRHaqNSKLnz5noBzfAT/y9XFQvtAdNKR2dXiNEpFXbp1iL8US5x1Gsxcv0dy4nfdYR6QpZ ZKJeEgZvsv/E4xejkNvgy/1q5TQBHpdwm+UAcOW/iSEx6DpdEzk0oqVrgfmf/g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715684969; a=rsa-sha256; cv=none; b=q8RqprBtrw9QXI0DUxuBHe0tTMzlGiEEGnD6pJxnItBMYJh4+I5WqvkZb04he1k/A9jUpD QdRviqjEw1eHN4kuwEX7drC50miKOWf/p/vFtv6Vwl33v6f/U++3TDk1WFIf3vEvoy+hEl mg9RWz72EcF7DJGc24JJxRMs+nzJLeRba0KMPCaiTqHYrbkRqPFBz2Dm4P7MLg2Nb5PtgQ zC9DREQ5l8U4QiR3dOSbL7bvyBRJvleZi32Z3tLaBNBFGBTd1t3HEJMKxHcmtcnjad/H8F y71gLQwWt1YL0NMuFiDE/iLW4HW40WhGAT8pB5uGYPELh8ksungzpltqwQVzFA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5C1DC73E6B for ; Tue, 14 May 2024 13:09:29 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6q1O-0005WK-Mp; Tue, 14 May 2024 07:08:38 -0400 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 1s6q1M-0005TC-P3 for emacs-orgmode@gnu.org; Tue, 14 May 2024 07:08:36 -0400 Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s6q1L-0006oI-59 for emacs-orgmode@gnu.org; Tue, 14 May 2024 07:08:36 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1s6q1H-0001wx-RV for emacs-orgmode@gnu.org; Tue, 14 May 2024 13:08:31 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: Re: [POLL] Dealing with +1m/y repeaters when jumping to impossible date (should 05-31 +1m be 07-01 or 06-30?) Date: Tue, 14 May 2024 18:08:20 +0700 Message-ID: References: <87frvzodze.fsf@localhost> <87v83if2io.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla Thunderbird Content-Language: en-US, ru-RU In-Reply-To: <87v83if2io.fsf@localhost> Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 26 X-Spam_score: 2.6 X-Spam_bar: ++ X-Spam_report: (2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: 0.64 X-Migadu-Queue-Id: 5C1DC73E6B X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: 0.64 X-TUID: gkNKh2w8gdiw On 13/05/2024 17:07, Ihor Radchenko wrote: > > However, there are still some issues remaining. > When updating timestamps repeating monthly across months with 30, 31, > and 28 days we get > > <2025-01-31 Fri +1m> > <2025-02-28 Fri +1m> > <2025-03-28 Fri +1m> > ... > <2026-01-28 Wed +1m> Instead of using timestamp obtained on previous step, use original timestamp and multiple of the interval. I have the following in my notes. However I have not find suitable functions in elisp: https://debbugs.gnu.org/54764#10 Paul Eggert. Sat, 9 Apr 2022 00:52:57 -0700 > Generally speaking, > when Org mode is doing calendrical calculations it should use > calendrical functions rather than encode-time+decode-time, which are > best used for time calculations not calendar calculations. Do you have any idea what Paul was writing about? On 13/05/2024 17:07, Ihor Radchenko wrote: > + (type-unit (pcase type > + ("h" 'hour) ("d" 'day) ("w" 'week) > + ("m" 'month) ("y" 'year)))) I do not mind against `pcase' here, I just expected something like `assoc' and `string-to-char'. > + ((or "m" "y") Another comment that may be ignored: `type-unit' values might be used here. > + (org-encode-time > + (list > + (+ (if (eq unit 'second) value 0) (decoded-time-second time)) > + (+ (if (eq unit 'minute) value 0) (decoded-time-minute time)) > + (+ (if (eq unit 'hour) value 0) (decoded-time-hour time)) > + (+ (if (eq unit 'day) value 0) (decoded-time-day time)) Have you considered using `min' with result of `date-days-in-month' here (or its sibling from timezone.el)? > +(defun org-time-inc (unit value time) Is there a chance that support of intervals like 1h20m will be required later? > + (+ (if (eq unit 'month) value 0) (decoded-time-month time)) > + (+ (if (eq unit 'year) value 0) (decoded-time-year time)) > + (decoded-time-weekday time) > + (if (memq unit '(day month year)) > + nil ; Avoid auto-adjustments of time when jumping across DST. Sorry, but you have to use -1, otherwise (format-time-string "%F %T %Z %z" (encode-time '(0 30 12 15 1 2000 'ignored nil "Africa/Juba")) "Africa/Juba") (error "Specified time is not representable") > + (decoded-time-dst time)) > + (decoded-time-zone time)))))) > + (if (not org-repeat-round-time) new-time I am in doubts if `org-time-inc' should access `org-repeat-round-time' directly or its value should be passed as an explicit argument. Perhaps the additional argument may be optional with fallback to `org-repeat-round-time' when it is omitted.