unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones
@ 2022-04-07 12:37 Max Nikulin
  2022-04-09  7:52 ` Paul Eggert
                   ` (2 more replies)
  0 siblings, 3 replies; 45+ messages in thread
From: Max Nikulin @ 2022-04-07 12:37 UTC (permalink / raw)
  To: 54764; +Cc: eggert, emacs-orgmode

Consider the following change of `encode-time' calling convention: last 
3 elements of the TIME argument as a list should be optional. I mean 
IGNORED, DST, and ZONE.

      (encode-time '(0 30 20 07 04 2022 nil -1 nil))
      (encode-time '(0 30 20 07 04 2022)) ; currently causes an error

Since Emacs-27 time fields as separated arguments are considered 
obsolete for calls of `encode-time'. Org mode keeps compatibility with 
Emacs-26 where passing all time components as a single list is not 
supported. Moreover, some time ago an attempt to use new style argument 
in the Emacs git repository (the change was never committed to the Org 
repository) caused a bug with handling of daylight saving time. See
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54731
for more details, the commit reverted the changes is 8ef37913d3.

I have tried to create a compatibility wrapper for Org mode that chooses 
calling convention of `encode-time' in dependence of Emacs version. I 
have realized that there are enough call sites where components of time 
are gathered from scratch and not obtained from e.g. prior call of 
`decode-time'. It is inconvenient to add 3 extra mandatory components at 
the each place. I am reluctant to add a helper that accepts 6-components 
list and adds 3 fields to the end of the list. I am afraid that it may 
affect e.g. agenda performance.

 From my point of view it is better to change implementation of 
`encode-time' so that it may accept 6-component list SECOND...YEAR. It 
should not add noticeable performance penalty but makes the function 
more convenient in use.

Old-style separate arguments for time components permits optional fields 
ended with ZONE. I do not mind that it should be deprecated since it is 
the source of surprise similar to the mentioned bug. Daylight saving 
time field matters only as a list component and ignored as a separate 
argument (by the way, it should be stressed in the docstring). It is too 
easy to confuse list and separate arguments in the code since both ways 
works but with a subtle difference: nil does not mean ignore the value.

      (encode-time '(0 30 20 07 04 2022 nil nil nil)) ; wrong!
      (encode-time 0 30 20 07 04 2022 nil nil nil) ; no problem

In the Org code it is unsure which way to call `encode-time' is more 
convenient. In a half of the cases a list is obtained from another 
function, but another half is timestamp built from computed components. 
Unless the inconsistency with DST I would say that both ways to call the 
function should be supported.

So my proposal is to not force Org mode to use new calling convention 
for `encode-time' till DST and ZONE list components will became optional 
ones in a released Emacs version. For a while minor changes in a couple 
of places in Org code should make it immune to accidental usage of new 
calling convention (modulo compatibility).





^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2022-05-01 17:15 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-07 12:37 bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones Max Nikulin
2022-04-09  7:52 ` Paul Eggert
     [not found] ` <149de00f-115b-5367-414f-c7700ef8966b@cs.ucla.edu>
2022-04-09 11:36   ` Max Nikulin
2022-04-13 14:40   ` Max Nikulin
2022-04-13 18:35     ` Paul Eggert
2022-04-14 13:19       ` Max Nikulin
     [not found]       ` <4a23f3a4-fe8f-d396-49d8-10034803be63@gmail.com>
2022-04-14 22:46         ` Paul Eggert
     [not found]         ` <52fb10fb-892a-f273-3be8-28793f27e204@cs.ucla.edu>
2022-04-15  2:14           ` Tim Cross
2022-04-15 17:23           ` Max Nikulin
     [not found]           ` <5cd820d4-ae67-43d4-9e63-c284d51ff1e4@gmail.com>
2022-04-16 19:23             ` Paul Eggert
2022-04-19  2:02             ` Paul Eggert
2022-04-19  5:50               ` Eli Zaretskii
     [not found]               ` <83tuapvcxs.fsf@gnu.org>
2022-04-19 22:22                 ` Paul Eggert
2022-04-20  7:23                   ` Eli Zaretskii
     [not found]                   ` <83fsm8tdzl.fsf@gnu.org>
2022-04-20 18:19                     ` Paul Eggert
2022-04-20 18:41                       ` Eli Zaretskii
2022-04-20 19:01                         ` Paul Eggert
     [not found]                         ` <4e41671c-fae8-61c4-845c-4c7ba4317e88@cs.ucla.edu>
2022-04-20 19:14                           ` Eli Zaretskii
     [not found]                           ` <83fsm7sh2s.fsf@gnu.org>
2022-04-20 19:23                             ` Paul Eggert
     [not found]                             ` <e4cc58ca-51f9-395e-05f5-5f06cb9d439d@cs.ucla.edu>
2022-04-20 19:30                               ` Eli Zaretskii
2022-04-21  0:11                                 ` Paul Eggert
     [not found]                                 ` <33fb24fb-282b-cc13-a597-e7b63f19982d@cs.ucla.edu>
2022-04-21  6:44                                   ` Eli Zaretskii
     [not found]                                   ` <83y1zzq6kd.fsf@gnu.org>
2022-04-21 15:30                                     ` Max Nikulin
2022-04-21 15:58                                       ` Eli Zaretskii
2022-04-21 17:23                                         ` Max Nikulin
2022-04-21 18:46                                           ` Eli Zaretskii
2022-04-21 23:56                                     ` Paul Eggert
     [not found]                                     ` <aa2bc0a0-1bec-37ff-919d-c20fcdfdab68@cs.ucla.edu>
2022-04-22  5:01                                       ` Eli Zaretskii
2022-04-23 14:35                       ` Bernhard Voelker
2022-04-20 15:07               ` Max Nikulin
     [not found]               ` <25d90a4b-f47d-01b4-2bfe-9951e97fe676@gmail.com>
2022-04-20 18:29                 ` Paul Eggert
2022-04-25 15:30                   ` Max Nikulin
2022-04-25 15:37                     ` Paul Eggert
     [not found]                     ` <4bd57f21-0660-fce0-d796-08c534402340@cs.ucla.edu>
2022-04-25 19:49                       ` Paul Eggert
2022-04-30 11:22                         ` Max Nikulin
2022-05-01  2:32                           ` Paul Eggert
2022-05-01 17:15                             ` Max Nikulin
     [not found]             ` <507cc0a2-d2d9-4283-7cc2-0da3c6510ac8@cs.ucla.edu>
2022-04-21 16:59               ` Max Nikulin
2022-04-13 15:12   ` Max Nikulin
2022-04-16 16:26   ` Max Nikulin
     [not found]   ` <2d57e59b-f971-483b-ad65-e0c5ff7883e8@gmail.com>
2022-04-17  1:58     ` Paul Eggert
     [not found]     ` <3624beb8-71fd-924e-a065-74d0034ed351@cs.ucla.edu>
2022-04-20 16:56       ` Max Nikulin
2022-04-20 19:17         ` Paul Eggert
     [not found] ` <handler.54764.D54764.165091617725815.notifdone@debbugs.gnu.org>
2022-04-25 21:16   ` Glenn Morris
2022-04-26  1:18     ` Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).