GNU bug report logs - #68969
[PATCH] Fix handling of delta values with negative month field

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Łukasz Stelmach <stlman@HIDDEN>; Keywords: patch; Done: Stefan Kangas <stefankangas@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 68969-done <at> debbugs.gnu.org:


Received: (at 68969-done) by debbugs.gnu.org; 1 Mar 2025 03:41:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 28 22:41:33 2025
Received: from localhost ([127.0.0.1]:57428 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1toDjI-0004gk-1J
	for submit <at> debbugs.gnu.org; Fri, 28 Feb 2025 22:41:33 -0500
Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:42456)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1toDjF-0004fo-G1
 for 68969-done <at> debbugs.gnu.org; Fri, 28 Feb 2025 22:41:30 -0500
Received: by mail-ej1-x62b.google.com with SMTP id
 a640c23a62f3a-ab744d5e567so470974766b.1
 for <68969-done <at> debbugs.gnu.org>; Fri, 28 Feb 2025 19:41:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740800483; x=1741405283; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=VecsGGEZRkenZFCjfLhPlSACGYLYUHfGs/U0jJ7gVEk=;
 b=UAwAMj5hKVz38QTUO9kDx3RmZPIxda1m3X0drc7xvPYC4J57hVPWd4fYHajDVjYjIP
 3FGkfv8Po9pIjyOihVHwR5SLT93nn6WQU/b5zEDu8+PnVPHEGQVRp9hL4nCRK+KaUyUy
 8DG1+nljM0kK24i3tLrqxbIB2UIA1e9lDtSmzgMO3b3Rkd9tURhtiOpxACuHZ9oZse1c
 4c57xnV1mpEedK++4okMgC9TNHX9guw/pFi0z2EgyJY3l3oCc2y8GpKxizuPz3rzwPPk
 7rYJ8yyAJRAY86p9PXzYRmlk8lTh+Ft2gGkWBhw/LYaJkfxxQxZUoYHBjHtYEjZWiSCr
 k0DQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740800483; x=1741405283;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=VecsGGEZRkenZFCjfLhPlSACGYLYUHfGs/U0jJ7gVEk=;
 b=Mrqh9GI3bTgd5E4rRMZ5+1G8Mo2PS9l4HOisikE5qWeXM0ggFJNTvXz1evpWnga4KI
 r4WNm9SKknYAREthCe67v+n9j9CaKngOddVCnIiOB7FpSDIYUaxhGGkwkRrlVOv1dnEw
 ke8bOwaCgpoPu0lUgqe42hBbYHzOq9o5XmKIKFcUPFlPhOnB4VHrduKEZ+J/yFeOdMje
 puHQDkQBy6jTVUjVUL21NtgVsYRXZlnxIeClD5EcGejILi5sbfokeOLolrT7usYGM0VP
 i3c6o1GpJubmOxRxaAosK5uDZTlsH1TW/45LjYUP6ax9YHskw6++ACjsqly5px1+1QL7
 SWrg==
X-Gm-Message-State: AOJu0Yy/TJMAKpCb0CfDkmOTnstnpKYoNkRD6JPw6TUlKCc6NZQKQGrR
 6mxoYN+CViQH3vw8M+mvf93g027xgGbrBF30NWg6YffBwi44RIxD7OpnXxb0vKp6yWS7hsAI3GF
 VvxZJePdjm6b7QBv/zZzcThi6W92WYvDf9kw=
X-Gm-Gg: ASbGnctX/rcXju11aP4wj6/f4zrkfyux6Y/53UFFMlLOGcgja9jfNroe4WTxcDQ7cZZ
 AjnA9Y3fbAEjNgCL+V5QKMuFsnDwEIwVIz0BFuhnPEGUy4QTtnFq+kcbzQbEgYexCDE2gxyFpu3
 n35QCjNRUEeOzSaKaYneu/9h8McSo=
X-Google-Smtp-Source: AGHT+IEQeNs/5n2CZ2cPmoT7BKum6gMcywN/ZUIVxG0nUMRW0QVLY7kmZYK9jOj+e6x31mV/HYCFrBZIan+qiELXyMs=
X-Received: by 2002:a17:906:478b:b0:abf:5778:f93e with SMTP id
 a640c23a62f3a-abf577952femr18710366b.20.1740800483167; Fri, 28 Feb 2025
 19:41:23 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 28 Feb 2025 19:41:22 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <877c5cn93m.fsf%stlman@HIDDEN>
References: <20240207133739.2419658-1-stlman@HIDDEN>
 <CADwFkmkyKXK_Z_=xBPLfF=x2gNW9BwEmZH+3cS-rbjzAQurQ0A@HIDDEN>
 <877c5cn93m.fsf%stlman@HIDDEN>
MIME-Version: 1.0
Date: Fri, 28 Feb 2025 19:41:22 -0800
X-Gm-Features: AQ5f1JooMuffvIPMp3-Oa6t8V9ay5FRNMQzk98cKBRVy7aiVzlOsUHO6lNjNwPQ
Message-ID: <CADwFkmmNcvJ33dH0kxTA0+=GL7t0O5tp9mu-OXaMV83X-wyvfg@HIDDEN>
Subject: Re: bug#68969: [PATCH] Fix handling of delta values with negative
 month field
To: =?UTF-8?Q?=C5=81ukasz_Stelmach?= <stlman@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 68969-done
Cc: 68969-done <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Version: 31.1

=C5=81ukasz Stelmach <stlman@HIDDEN> writes:

> Stefan Kangas <stefankangas@HIDDEN> writes:
>
>> =C5=81ukasz Stelmach <stlman@HIDDEN> writes:
>>
>>> * lisp/calendar/time-date.el (decoded-time-add): If the new
>>> variable is less then zero, the year needs to be decremented
>>> by quotient of new and 12 increased by one.
>>> * test/lisp/calendar/time-date-tests.el (test-decoded-add):
>>> Add applicable test cases.
>>> ---
>>>  lisp/calendar/time-date.el            |  2 +-
>>>  test/lisp/calendar/time-date-tests.el | 12 ++++++++++++
>>>  2 files changed, 13 insertions(+), 1 deletion(-)
>>
>> Thanks, and sorry for the late reply here.
>>
>> Could you please explain what is the issue that this patch fixes?  Is
>> there a concrete use case that made you run into this?
>
> I was playing with Gnus' message list limiting
> gnus-summary-limit-to-age[1] and making my own
> lksz-gnus-summary-limit-to-month before sending this patch, but honestly
> I can't remember exactly. Beginning of a year may suggest that I was
> moving some e-mail messages between archive folders and something wasn't
> right across the year boundary. This is as close as I can guess.
>
> I still believe, however, the patch as it is needed and makes sense.
>
> [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D58820

Thanks for the patch.  I installed it on master.

I'm therefore closing this bug report.




Notification sent to Łukasz Stelmach <stlman@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Stefan Kangas <stefankangas@HIDDEN>:
You have taken responsibility. Full text available.

Message received at 68969 <at> debbugs.gnu.org:


Received: (at 68969) by debbugs.gnu.org; 26 Feb 2025 13:12:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 26 08:12:27 2025
Received: from localhost ([127.0.0.1]:51470 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tnHD8-0000Gv-QJ
	for submit <at> debbugs.gnu.org; Wed, 26 Feb 2025 08:12:27 -0500
Received: from smtpo49.interia.pl ([217.74.67.49]:39477)
 by debbugs.gnu.org with esmtps (TLS1.2:RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stlman@HIDDEN>) id 1tnHD6-0000Gc-9e
 for 68969 <at> debbugs.gnu.org; Wed, 26 Feb 2025 08:12:25 -0500
Received: from localhost (89-64-83-179.dynamic.chello.pl [89.64.83.179])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest
 SHA256) (No client certificate requested)
 by poczta.interia.pl (INTERIA.PL) with ESMTPSA;
 Wed, 26 Feb 2025 14:12:15 +0100 (CET)
From: =?utf-8?Q?=C5=81ukasz?= Stelmach <stlman@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#68969: [PATCH] Fix handling of delta values with negative
 month field
References: <20240207133739.2419658-1-stlman@HIDDEN>
 <CADwFkmkyKXK_Z_=xBPLfF=x2gNW9BwEmZH+3cS-rbjzAQurQ0A@HIDDEN>
X-Hashcash: 1:24:250226:68969 <at> debbugs.gnu.org::OpSmKNJQsqHxLwiI:GXvU
X-Hashcash: 1:24:250226:stlman@HIDDEN::8zue2x9/0vmLdOKu:gyoT
X-Hashcash: 1:24:250226:stefankangas@HIDDEN::WO2YDFt6XhaDugmI:0HGU+
Date: Wed, 26 Feb 2025 14:12:13 +0100
In-Reply-To: <CADwFkmkyKXK_Z_=xBPLfF=x2gNW9BwEmZH+3cS-rbjzAQurQ0A@HIDDEN>
 (Stefan Kangas's message of "Sun, 23 Feb 2025 00:59:37 +0000")
Message-ID: <877c5cn93m.fsf%stlman@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-IPL-Priority-Group: 0-0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poczta.fm; s=dk;
 t=1740575537; bh=e6SM2o/LwLtmDPgXiSo53jpwk6oD0eY8IThhfbc05ko=;
 h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type;
 b=nde1DnX6PkX44beaUfQjnHw4ME80lP85ETKCkzhf3033AjAwrKAsbOioYakgFbaXf
 2cuJKd7oVA8o0Y7Mp5MbS4gNT/TbCqYHJuW09D2ANtMB4o6JFwBg77QekMalZALz5z
 QxS/WH9pGlBzyKBd4pMqLl6qLCBHjAP0TlHlZghQ=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 68969
Cc: 68969 <at> debbugs.gnu.org, =?utf-8?Q?=C5=81ukasz?= Stelmach <stlman@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Stefan Kangas <stefankangas@HIDDEN> writes:

> =C5=81ukasz Stelmach <stlman@HIDDEN> writes:
>
>> * lisp/calendar/time-date.el (decoded-time-add): If the new
>> variable is less then zero, the year needs to be decremented
>> by quotient of new and 12 increased by one.
>> * test/lisp/calendar/time-date-tests.el (test-decoded-add):
>> Add applicable test cases.
>> ---
>>  lisp/calendar/time-date.el            |  2 +-
>>  test/lisp/calendar/time-date-tests.el | 12 ++++++++++++
>>  2 files changed, 13 insertions(+), 1 deletion(-)
>
> Thanks, and sorry for the late reply here.
>
> Could you please explain what is the issue that this patch fixes?  Is
> there a concrete use case that made you run into this?

I was playing with Gnus' message list limiting
gnus-summary-limit-to-age[1] and making my own
lksz-gnus-summary-limit-to-month before sending this patch, but honestly
I can't remember exactly. Beginning of a year may suggest that I was
moving some e-mail messages between archive folders and something wasn't
right across the year boundary. This is as close as I can guess.

I still believe, however, the patch as it is needed and makes sense.

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D58820
=2D-=20
Kind regards,
=C5=81ukasz Stelmach

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGTBAEBCgB9FiEEkPlMeih05HaDBMFPALaXbGOR03EFAme/Ey9fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDkw
Rjk0QzdBMjg3NEU0NzY4MzA0QzE0RjAwQjY5NzZDNjM5MUQzNzEACgkQALaXbGOR
03EHNAf9FqyDFKyj6KjlQgF2Y9pjZUgNpU/AlTTKmcj/lE7EWj3l2D3/Re1pQVcd
qsH/Vvi1gyUFESLHiJoE8dyAw1aFLh3GOuocIudlrQ2maopSN+klHw578VW+YpEb
cvad4VF13qMVDDzHovxGk6E5v1gNdjWfEdmg6hy6sx89bTEt6ueCcUBeqRlwIpr5
ed+bDfQtIIVZWTwktvZyvU//UdGqlxHYOLG353FB5wxnYLADtlXlJnL5n8uIbMMB
8XyVNNisdmIw1P9TSpWe09cyxIW8yOw8gPfbvk/DzISIqDlV/EQszYfS1pbxF/M4
AYFiDCto4Rda18+GPFt9KKmhxPKr1A==
=nrSY
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#68969; Package emacs. Full text available.

Message received at 68969 <at> debbugs.gnu.org:


Received: (at 68969) by debbugs.gnu.org; 23 Feb 2025 00:59:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 22 19:59:47 2025
Received: from localhost ([127.0.0.1]:58094 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tm0LT-0000nn-5v
	for submit <at> debbugs.gnu.org; Sat, 22 Feb 2025 19:59:47 -0500
Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:60432)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1tm0LQ-0000nR-9y
 for 68969 <at> debbugs.gnu.org; Sat, 22 Feb 2025 19:59:45 -0500
Received: by mail-ed1-x530.google.com with SMTP id
 4fb4d7f45d1cf-5e0373c7f55so5069940a12.0
 for <68969 <at> debbugs.gnu.org>; Sat, 22 Feb 2025 16:59:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740272378; x=1740877178; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Z15fUt6iePZlrCSUxp01lib8hqENny0adAd3fWQ4kT4=;
 b=I0dkEOYD8oUmmjYJR/uxt4IL5vh3TmfB/q4azTSG56g5UpDftK6SWuiRYrRjZAQHdJ
 A4m8FAJku31P9wfl0hJivEl66VNqHzedWOeBfOJFMG8E40hBMv3JcDm6ByOAVz3ANtwm
 YfPxedVVcyH/rUYpfFIGLXykYfNz2mFmE+50NfEEY2Cw+6JfRCZXdbpDKGd2RyGNdfa0
 gG47Yx9diXk9iKDgyl3CbN6oVgBvznf7YWwDnUHJiaG5T8BdMQVlScNaHiVrg6skviwv
 tJJcLd5I98+fnZx7LSb1ZEfihL5ZFxQXQg7PqSljvJIqXMvgirAXSh+Gs3AcmvUxibGs
 wHlQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740272378; x=1740877178;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=Z15fUt6iePZlrCSUxp01lib8hqENny0adAd3fWQ4kT4=;
 b=DxDFvmSlVehuA0YMuIUsZoZqyjDocqUA3AkGJP7UDKLiH+dTXhAzi3P6vWd/xnsWcX
 fSRrVnTJI/SWK+6cuGfPL1eajzSjTsLm2vKvBppOHElRkefX2Eq38UWP2A+B2zZTlAdw
 nyxBfscNQ0UsxBxe1OAzcS3eCIb+brKVqyrwadrR0vsvyRhfeBV5nvMw6boOFqBNGWfX
 ZIzHhXkNoSRpH1x7UKlQmGA2SPGYKxTPPhSQSYFIsGAdQbQZfd7k2+2sG52TKaRFtqiJ
 N20wyZalOfHuxYv+Ce968E9PGavx3fgMOVzOKN1C3z2CJLSjTJErVYb/S4enfd6dA7Qf
 Qt7g==
X-Gm-Message-State: AOJu0YytRc78YNX6KFhyR64tEisuGsF3AbXmjAsBr/dQQIZCT6u9gYuL
 ajBQBW2v+oreyYfWqSVxOoN3IvGoJlwoYC0l/nQyGpihrb7O1IXq9VH8Is/loAwVeTLp2qf/jdx
 rm66WzP9IBa383/D2+CRgl8PQluE=
X-Gm-Gg: ASbGncvqWA+xhgra/2GHJJubtRaF2Oq1VlwL6hnN70dSerHzXvo6RKmojhNpATolO/Z
 yePtEMsLGOnMJtY0oJ72XewuqNDAzoWKTKPWhLM7YhdLwalBj75mH6Ii06jC5B+IjS90EkBQ+g2
 HHZ/aophJx
X-Google-Smtp-Source: AGHT+IHEz4OWt8WP7H14WL83Jz6mkse8O5PAgalq1UnwyIAIxzxOUTUJEr8b6b4PkQjXuMLZmSmEp9LVsIcOaef01ME=
X-Received: by 2002:a05:6402:50ca:b0:5e0:4e59:27a6 with SMTP id
 4fb4d7f45d1cf-5e0b725077emr7828650a12.31.1740272378038; Sat, 22 Feb 2025
 16:59:38 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sun, 23 Feb 2025 00:59:37 +0000
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <20240207133739.2419658-1-stlman@HIDDEN>
References: <20240207133739.2419658-1-stlman@HIDDEN>
MIME-Version: 1.0
Date: Sun, 23 Feb 2025 00:59:37 +0000
X-Gm-Features: AWEUYZl4cr7K6sk8eiIkFlgHCjq4DT7Jf7-h9jUWsU8uP96QI0osV75FYWhW7Bw
Message-ID: <CADwFkmkyKXK_Z_=xBPLfF=x2gNW9BwEmZH+3cS-rbjzAQurQ0A@HIDDEN>
Subject: Re: bug#68969: [PATCH] Fix handling of delta values with negative
 month field
To: =?UTF-8?Q?=C5=81ukasz_Stelmach?= <stlman@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 68969
Cc: 68969 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

=C5=81ukasz Stelmach <stlman@HIDDEN> writes:

> * lisp/calendar/time-date.el (decoded-time-add): If the new
> variable is less then zero, the year needs to be decremented
> by quotient of new and 12 increased by one.
> * test/lisp/calendar/time-date-tests.el (test-decoded-add):
> Add applicable test cases.
> ---
>  lisp/calendar/time-date.el            |  2 +-
>  test/lisp/calendar/time-date-tests.el | 12 ++++++++++++
>  2 files changed, 13 insertions(+), 1 deletion(-)

Thanks, and sorry for the late reply here.

Could you please explain what is the issue that this patch fixes?  Is
there a concrete use case that made you run into this?

> diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
> index e96e2e7e2db..68b05314f3c 100644
> --- a/lisp/calendar/time-date.el
> +++ b/lisp/calendar/time-date.el
> @@ -473,7 +473,7 @@ decoded-time-add
>      (when (decoded-time-month delta)
>        (let ((new (+ (1- (decoded-time-month time)) (decoded-time-month d=
elta))))
>          (setf (decoded-time-month time) (1+ (mod new 12)))
> -        (cl-incf (decoded-time-year time) (/ new 12))))
> +        (cl-incf (decoded-time-year time) (- (/ new 12) (if (< new 0) 1 =
0)))))
>
>      ;; Adjust for month length (as described in the doc string).
>      (setf (decoded-time-day time)
> diff --git a/test/lisp/calendar/time-date-tests.el b/test/lisp/calendar/t=
ime-date-tests.el
> index 01f9f8a5108..4ca274fcec6 100644
> --- a/test/lisp/calendar/time-date-tests.el
> +++ b/test/lisp/calendar/time-date-tests.el
> @@ -131,6 +131,18 @@ test-decoded-add
>      (should (equal (decoded-time-add time (mdec :month 10))
>                     '(12 15 16 8 5 2020 1 t 7200)))
>
> +    (should (equal (decoded-time-add time (mdec :month -1))
> +                   '(12 15 16 8 6 2019 1 t 7200)))
> +
> +    (should (equal (decoded-time-add time (mdec :month -10))
> +                   '(12 15 16 8 9 2018 1 t 7200)))
> +
> +    (should (equal (decoded-time-add time (mdec :month -14))
> +                   '(12 15 16 8 5 2018 1 t 7200)))
> +
> +    (should (equal (decoded-time-add time (mdec :month -24))
> +                   '(12 15 16 8 7 2017 1 t 7200)))
> +
>      (should (equal (decoded-time-add time (mdec :day 1))
>                     '(12 15 16 9 7 2019 1 t 7200)))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#68969; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Feb 2024 13:38:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 07 08:38:14 2024
Received: from localhost ([127.0.0.1]:55898 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rXi7y-000396-6F
	for submit <at> debbugs.gnu.org; Wed, 07 Feb 2024 08:38:14 -0500
Received: from lists.gnu.org ([2001:470:142::17]:44982)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stlman@HIDDEN>) id 1rXi7w-00038r-Hi
 for submit <at> debbugs.gnu.org; Wed, 07 Feb 2024 08:38:12 -0500
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 <stlman@HIDDEN>) id 1rXi7d-00080x-31
 for bug-gnu-emacs@HIDDEN; Wed, 07 Feb 2024 08:37:53 -0500
Received: from smtpo48.interia.pl ([217.74.67.48])
 by eggs.gnu.org with esmtps (TLS1.2:RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <stlman@HIDDEN>) id 1rXi7b-0000z6-67
 for bug-gnu-emacs@HIDDEN; Wed, 07 Feb 2024 08:37:52 -0500
Received: from localhost (unknown [213.134.160.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest
 SHA256) (No client certificate requested)
 by poczta.interia.pl (INTERIA.PL) with ESMTPSA;
 Wed,  7 Feb 2024 14:37:45 +0100 (CET)
From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <stlman@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Fix handling of delta values with negative month field
Date: Wed,  7 Feb 2024 14:37:39 +0100
Message-Id: <20240207133739.2419658-1-stlman@HIDDEN>
X-Mailer: git-send-email 2.39.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-IPL-Priority-Group: 0-0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poczta.fm; s=dk;
 t=1707313066; bh=535UFXVM7rjwOq0pcNt799rIoP5pWS4W6Ybg9P7WHC0=;
 h=From:To:Subject:Date:Message-Id:MIME-Version;
 b=pfIbUNBwVMczM8+WtD/oBDArPGloT3j3YoAvTDz2pMFLBKs1VzAdzOtfDCIwGakTO
 uRgbs9kHQxL4rcqSmYmCHer1ynm/3jIBc4BQRY7vdwa8I2/XWSZG+CtW+sB+W6IFtW
 jwjU8g9ZZYsjcpdVuBDAEAjsNciP7Hnic3B4hddU=
Received-SPF: pass client-ip=217.74.67.48; envelope-from=stlman@HIDDEN;
 helo=smtpo48.interia.pl
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <stlman@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

* lisp/calendar/time-date.el (decoded-time-add): If the new
variable is less then zero, the year needs to be decremented
by quotient of new and 12 increased by one.
* test/lisp/calendar/time-date-tests.el (test-decoded-add):
Add applicable test cases.
---
 lisp/calendar/time-date.el            |  2 +-
 test/lisp/calendar/time-date-tests.el | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index e96e2e7e2db..68b05314f3c 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -473,7 +473,7 @@ decoded-time-add
     (when (decoded-time-month delta)
       (let ((new (+ (1- (decoded-time-month time)) (decoded-time-month delta))))
         (setf (decoded-time-month time) (1+ (mod new 12)))
-        (cl-incf (decoded-time-year time) (/ new 12))))
+        (cl-incf (decoded-time-year time) (- (/ new 12) (if (< new 0) 1 0)))))
 
     ;; Adjust for month length (as described in the doc string).
     (setf (decoded-time-day time)
diff --git a/test/lisp/calendar/time-date-tests.el b/test/lisp/calendar/time-date-tests.el
index 01f9f8a5108..4ca274fcec6 100644
--- a/test/lisp/calendar/time-date-tests.el
+++ b/test/lisp/calendar/time-date-tests.el
@@ -131,6 +131,18 @@ test-decoded-add
     (should (equal (decoded-time-add time (mdec :month 10))
                    '(12 15 16 8 5 2020 1 t 7200)))
 
+    (should (equal (decoded-time-add time (mdec :month -1))
+                   '(12 15 16 8 6 2019 1 t 7200)))
+
+    (should (equal (decoded-time-add time (mdec :month -10))
+                   '(12 15 16 8 9 2018 1 t 7200)))
+
+    (should (equal (decoded-time-add time (mdec :month -14))
+                   '(12 15 16 8 5 2018 1 t 7200)))
+
+    (should (equal (decoded-time-add time (mdec :month -24))
+                   '(12 15 16 8 7 2017 1 t 7200)))
+
     (should (equal (decoded-time-add time (mdec :day 1))
                    '(12 15 16 9 7 2019 1 t 7200)))
 
-- 
2.39.2





Acknowledgement sent to Łukasz Stelmach <stlman@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#68969; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 1 Mar 2025 03:45:02 UTC

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