[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3] org-encode-time compatibility and convenience helper

From: Max Nikulin
Subject: [PATCH v3] org-encode-time compatibility and convenience helper
Date: Tue, 3 May 2022 19:14:47 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1

On 26/04/2022 16:07, Ihor Radchenko wrote:

LGTM. I think you can go ahead and continue with the followup patch
making use of the new macro.

The attached patch set is assumed to be complete.

I have no chance to thoroughly test it. Existing unit tests pass for Emacs-26 and Emacs-27. Nothing has changed for Emacs-25, as for the "main" branch one test fails. I have not tried Emacs-28 or the current git version.

In comparison to the previous patch version I have expanded the docstring and added a bit more tests. I have tried to support recently committed to Emacs 6-elements list for `encode-time', but I do not like the following compile-time warning:

In toplevel form:
org-macs.el:1397:23:Warning: encode-time called with 1 argument, but requires

I had to carve the patch originally posted by Paul Eggert for the Emacs repository to adapt it for the Org repository and to drop org-encode-time-1 chunks.

The largest patch replaces all calls of `encode-time' to `org-encode-time'

Goals of `org-encode-time':
- it should work at the compile or load time to minimize runtime performance impact, - since both ways to call `encode-time' are necessary (in a half of cases a list returned by `decode-time' is available, in other cases timestamps are assembled from scratch, none is preferred), it should be convenient in both cases, - it should allow Org to work even if support of multiple `encode-time' arguments will be removed from Emacs, - it should allow to avoid a pitfall with Emacs-27+ `encode-time': DST argument is taken into account when the function called with single list argument but it is ignored when multiple arguments is passed. `org-encode-time' respects DST value unless it is running in Emacs-26 or earlier. I have not added special code for old versions considering it as graceful degradation.

Finally, let me remind that these changes are result of the following discussions:

Ignacio Casso to emacs-orgmode. [BUG] org-agenda thinks timestamps after 23:00 correspond to the next day. Tue, 29 Mar 2022 15:09:10 +0200. https://list.orgmode.org/PAXPR06MB7760238F410CBE3203F78EE0C61E9@PAXPR06MB7760.eurprd06.prod.outlook.com

#54731 - Please, revert part of dd0727e1ec1 related to Org mode (`encode-time') - GNU bug report logs

#54764 - encode-time: make DST and TIMEZONE fields of the list argument optional ones - GNU bug report logs

Attachment: 0001-Use-unknown-DST-instead-of-standard-time-in-timestam.patch
Description: Text Data

Attachment: 0002-test-org.el-Fix-tests-for-org-parse-time-string.patch
Description: Text Data

Attachment: 0003-Use-higher-level-helpers-instead-of-encode-time.patch
Description: Text Data

Attachment: 0004-testing-lisp-Use-org-time-string-to-time.patch
Description: Text Data

Attachment: 0005-org-macs.el-Introduce-a-helper-for-encode-time.patch
Description: Text Data

Attachment: 0006-Use-org-encode-time-helper-macro.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]