Morgan Smith <[email protected]> writes:
>> The patch is fine in general. But now we also need to go through all the
>> users of `org-parse-time-string' and check whether they need to be changed.
>
> While the decoded-time struct might be a real "cl-defstruct", I don't
> think it actually exists as it's own object. As in I think the list is
> literally indistinguishable from any kind of "decoded-time" struct. I
> think this because the constructor for "decoded-time" is nil and the
> definition of the function "make-decoded-time" (please do read that
> definition). I could be wrong though since I don't understand a lot of
> the cl- stuff so do let me know.
You are not wrong. However, cl-defstruct has multiple ways to create new
structures, depending on :type keyword. For now,
(cl-defstruct (decoded-time
(:constructor nil)
(:copier nil)
(:type list))
uses a list, so it is indeed indistinguishable.
However, I do not like relying upon this detail. The fact that
make-decoded-time does it is not ideal in my book.
In practice, it is unlikely that Emacs devs are going to change the
low-level representation of the struct. However, I thought that
highlighting the potential problem would be instructive. The patches you
send also make the relevant code more readable. After all, (nth X date)
is much less readable compared to (decoded-time-day/month/etc date).
> I did only come to the above conclusion after spending far too long
> making two patches to make org use time access functions though so I'm
> still submitting those.
Those are useful, especially from maintenance perspective!
> The rest of the patches are the same except the last patch where I now
> limit the day to be 27 instead of 28 as I was getting test failures for
> the following string which includes a day of 29 since I add an hour for
> the second timestamp:
>
> "CLOCK: [2026-03-28 Sat 23:33]--[2026-03-29 Sun 00:33] => 1:00"
Could you explain in more details?
Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=15c1ca119
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4edd65c39
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b9bd49bcf
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=fbef389fd
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c9e26e8fa
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d6baddca2
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=735d189d2
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=42e7e3356
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4f1bdf83e
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9c548504b
--
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>