GNU bug report logs - #74869
[PATCH] Add predicates for decoded times and time deltas

Previous Next

Package: emacs;

Reported by: Richard Lawrence <rwl <at> recursewithless.net>

Date: Sat, 14 Dec 2024 16:13:02 UTC

Severity: wishlist

Tags: patch

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#74869: closed ([PATCH] Add predicates for decoded times and
 time deltas)
Date: Wed, 12 Feb 2025 05:52:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 11 Feb 2025 21:51:43 -0800
with message-id <CADwFkmkS6zM9zXWfF8XTJKhFwXrDXLuBzceQWJLSuL8879SscQ <at> mail.gmail.com>
and subject line Re: bug#74869: Fwd: [PATCH] Add predicates for decoded times and time deltas
has caused the debbugs.gnu.org bug report #74869,
regarding [PATCH] Add predicates for decoded times and time deltas
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
74869: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74869
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Richard Lawrence <rwl <at> recursewithless.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Add predicates for decoded times and time deltas
Date: Sat, 14 Dec 2024 17:11:41 +0100
[Message part 3 (text/plain, inline)]
Tags: patch

This is a rough draft of a patch to add two new predicates related to
decoded times: `decoded-time-p', which checks that a value is a decoded
time (as documented in `decode-time'), and
`decoded-time-delta-p', which checks that a value is a time delta (as
documented in `decoded-time-add').

Some questions:

1) Should these functions go in simple.el? I put them there because that
is where the structure definition for decoded-time is. (The definition
does not generate a predicate automatically because it uses :type but
not :named; see Info node `(cl)Structures'.) But at least
`decoded-time-delta-p' might be better off in time-date.el, which is
where `decoded-time-add' is defined.

2) Should `decoded-time-p' also check the weekday slot of decoded times?
See the FIXME comment in the middle of the function: `make-decoded-time'
neither sets this slot nor provides an argument to let the caller set
it. This is apparently intentional: there is a comment in the
definition of `make-decoded-time',

  ;; Do not set decoded-time-weekday or decoded-time-dst,
  ;; as encode-time can infer them well enough when unknown.

but if the slot is not meant to be set I don't understand why it's
there. It would be useful, for iCalendar purposes, to have the weekday
slot automatically calculated from the date values when a decoded time
is constructed. I'm not sure if this use was just not envisioned, or if
there was a more substantial reason not to do it in make-decoded-time.

Hopefully I got the commit message right this time, but please let me
know if that needs tweaking too...

Best,
Richard

[0001-Add-predicates-for-decoded-times-and-time-deltas.patch (text/patch, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Stefan Kangas <stefankangas <at> gmail.com>
To: Richard Lawrence <rwl <at> recursewithless.net>,
 Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 74869-done <at> debbugs.gnu.org
Subject: Re: bug#74869: Fwd: [PATCH] Add predicates for decoded times and time
 deltas
Date: Tue, 11 Feb 2025 21:51:43 -0800
Richard Lawrence <rwl <at> recursewithless.net> writes:

> Paul Eggert <eggert <at> cs.ucla.edu> writes:
>
>> On 2/11/25 11:14, Stefan Kangas wrote:
>>
>>> Does that mean to imply that this bug is a wontfix?
>>
>> Given rwl's December 29 message
>> <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=74869#16> it sounds like
>> it might be better to have something like an icalendar-decoded-time-p
>> function, which follows the iCalendar standard as opposed to Emacs's
>> more-idiosyncratic rules. So, not a wontfix; more a "let's keep this in
>> iCalendar for now".
>
> Yes, that's fine with me; so I guess this bug can be closed.

OK, so I'm doing that now.

Thanks for working improving our iCalendar support, that is greatly
appreciated.


This bug report was last modified 97 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.