GNU bug report logs - #75789
[PATCH Debbugs] Factor cache accesses into dedicated functions

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; Severity: wishlist; Reported by: Morgan Smith <Morgan.J.Smith@HIDDEN>; Keywords: patch; Done: Michael Albinus <michael.albinus@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 75789-done) by debbugs.gnu.org; 15 Feb 2025 17:38:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 15 12:38:19 2025
Received: from localhost ([127.0.0.1]:57717 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tjM7O-0005LM-JT
	for submit <at> debbugs.gnu.org; Sat, 15 Feb 2025 12:38:18 -0500
Received: from mout.gmx.net ([212.227.15.15]:35989)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael.albinus@HIDDEN>)
 id 1tjM7L-0005L2-9I
 for 75789-done <at> debbugs.gnu.org; Sat, 15 Feb 2025 12:38:16 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de;
 s=s31663417; t=1739641085; x=1740245885; i=michael.albinus@HIDDEN;
 bh=JKsMuPhORcCCZL7hMFyJgxMQe3CpwgAmv/F9GkBbowU=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=ubVWwGXhF5zwJeEMj60XBQibPOYiJsyx2eA/t9o3+6VQX+L+cSbx8oIzGBm5ilQf
 yT3lMfSXa0W2A6HcBZmj5PjkpPK4bBOb1/HkqWtShyViQ9a8UJ9/vXqU52t9MZn/4
 YmH4LxspCyOUg76z4zjnk4D43ut9p8NcVJi6nLCyxfzBvPga/RT2JRSMfZUllD84t
 wgWxGgsaSogoAp/gC+BF9fTHkwybK5jZKwaDEUNrfWjieu/mLV8/wc4rPVP25MnFR
 XEA7FM5uMG7Y4zQ+cIkQQ/JF59KJ4AAOR/bG17Nho8mgE2mvPvAJfYXrxiIdyFcMw
 LK23qfnrHjKZeq3gkA==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M4JqV-1tjdEK2689-005bmh; Sat, 15
 Feb 2025 18:38:05 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Morgan Smith <Morgan.J.Smith@HIDDEN>
Subject: Re: bug#75143: debbugs info manual name
In-Reply-To: <CH3PR84MB34242A4861B0865B23D9A98DC5FE2@HIDDEN>
References: <CH3PR84MB3424068D214C8E11FA0D2A6FC50E2@HIDDEN>
 <87cyhd6ohz.fsf@HIDDEN>
 <CH3PR84MB3424EDE1E5FC9A4F68015AA0C50E2@HIDDEN>
 <877c7k6o26.fsf@HIDDEN> <87ikpgtvxr.fsf@HIDDEN>
 <CH3PR84MB34242A4861B0865B23D9A98DC5FE2@HIDDEN>
Date: Sat, 15 Feb 2025 18:38:05 +0100
Message-ID: <87wmdrcdmq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:sL/Ldrln5ctaoyiKoG6Sy+ZY95zjgMUsfBVdw3fJJYT7NvQUiec
 KHPvx3H2EOUmTCmBiKYaT2yPyy+xZ82NYJK+ctuYm8q7UkOIs/fUt04c1glNiJo6WIBnKR0
 Ddp8c5fgfsYeC69EazMT+SFeDAzARWz/2CwJQvt6khiC3FNFoRL7Y1rXIpKgahs+Qpw1bML
 j0l2HGg/YckAniyaN59+A==
X-Spam-Flag: NO
UI-Outbo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YXGjq+6z/qE547ZMa8hIwnqzi9270K0pd4WVlj6BT
 wwIrZgEcARrWG0REbeXN7Mjlwg1WHhUZpIZYOy1dqTH4dY7Zl311G549Wj43ggQ1FD9BSb7Wp
 YxI1zc3D4OhLOIsx+1wPi+CbEYrwspMAB1gLcsFlQzhMSmAadyT3uP8Dl+Xr7ej/+NKcsIeDO
 6IdMjzk+3YbOHng505l4NXP8TewXc2t5ECCIItPLysdoLA88M1ZDazzXYKXdWiIq23gT1uNSi
 w0fPZXN/KyDDbN0cj8cmYheI4+E36QEpPFRIJX3wqQNezh5HsT/lYmvq4DcxQhQKTvcHAQcQs
 9siyt6/0pw73sj4adi1+HZ3CgcvrHSNpE3GStUtOTEA3fFB92Yl64BD1PzqROsC7tatUH9u/U
 WTMWs4JQWGlIuDUh1ZYmUmzp6+lowXGCXqBJokThwb93n0HRtRCcXj16hB
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75789-done
Cc: 75789-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.7 (-)

Morgan Smith <Morgan.J.Smith@HIDDEN> writes:

> Hi Michael,

Hi Morgan,

> However, I think I did come up with a way to simply change the user
> facing name of the manual without breaking links.  I'm not super well
> versed in texinfo but after applying the attached changes and installing
> them on my system, I have been able to access the manuals using new
> names yet the links within the manual that link to each other seem to
> remain functional.
>
> Let me know what you think!

LGTM, thanks! I've pushed both patches to the ELPA git repo. In a couple
of days I'll release a new debbugs version.

Closing the bug.

> Thanks,
>
> Morgan

Best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75789; Package emacs. Full text available.
bug marked as fixed in version 31.1, send any further explanations to 75789 <at> debbugs.gnu.org and Morgan Smith <Morgan.J.Smith@HIDDEN> Request was from Michael Albinus <michael.albinus@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 75789) by debbugs.gnu.org; 11 Feb 2025 11:04:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 11 06:04:29 2025
Received: from localhost ([127.0.0.1]:54557 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tho42-0008T6-DA
	for submit <at> debbugs.gnu.org; Tue, 11 Feb 2025 06:04:29 -0500
Received: from mout.gmx.net ([212.227.15.15]:39847)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael.albinus@HIDDEN>)
 id 1tho3z-0008Sg-Mf
 for 75789 <at> debbugs.gnu.org; Tue, 11 Feb 2025 06:04:24 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de;
 s=s31663417; t=1739271857; x=1739876657; i=michael.albinus@HIDDEN;
 bh=S0TtanLHQGZnvhZPJX/LgxzTATfk5WNyvqnHwikHJao=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=cUTfPKVVeaRuasQT1d5VZG1zXf/DHcDTPP4N3WlrC1oTPZlPvGUcFy+JAx8PQydN
 RHRFjyR0dDCULnW4XU+7HBw+nAYuga+sZqJzI+8ypqfeVduZhUJt6iq8s4xRR6fvb
 rXWgyTSfprtuHuu1UhcQtwMgsBs/E3SH+PoodwtngzqLlYP3ynSTAm3fpHZP9WbSu
 /jiRS/gEf04FquNkwwhpa+mMTWqcTPs2KRg+2OFfLo3iEzVBCASfCOQFLjLM13YAw
 KKAocGMRkJ/f6JLhQ0KkHyh6+tN37/LfZUilN8xut+VTOORghUVBeNpymZ6LQIKcW
 1gw19wNJx5QuVkb0Ig==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx005
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M3lY1-1tgyqg1GeR-006st7; Tue, 11
 Feb 2025 12:04:17 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Morgan Smith <morgan.j.smith@HIDDEN>
Subject: Re: bug#75789: [PATCH Debbugs] Factor cache accesses into dedicated
 functions
In-Reply-To: <CH3PR84MB34244F1E4014FF6A331ED388C5F22@HIDDEN>
 (Morgan Smith's message of "Sun, 09 Feb 2025 21:01:30 -0500")
References: <CH3PR84MB342425F4DDC526B5A474FC52C5E02@HIDDEN>
 <874j1llupi.fsf@HIDDEN>
 <CH3PR84MB34244F1E4014FF6A331ED388C5F22@HIDDEN>
Date: Tue, 11 Feb 2025 12:04:16 +0100
Message-ID: <87pljoagjz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:iG33WhvJuPAh/EyxC/aNJOb4n+da6gBYow3Y+Q7HG6DXiDlODOl
 ljv9bdBgGeQ7klTOKatsgPmKS2JT4frtcuyDtKGe3lQGjIzoatz0vvbkvtWNlWkYHT1gI2+
 vlFvh3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PymvKynqvIzuDJ9kqjaWDcj4H59YDe9d3hIc8QvZqvHcEFqSi4j39TbmEBxYEiGQvz2NUS
 e64t0BPcEWZzGcWRAJOe60fAu+ce+y7H525duwv1IQr0kJ5FTX/Smw6EkGchTuGv9ufzz3bgV
 g2YaCSWMfAQDrdx9lqvi5LvR3F4AmzuD21s+rE2bXV+REa4e7T9u9HKYyoE7m/I6Dob/9xvVU
 FvABvQNgLKEr4cVV2k+2Giu7jzbW0oRETohQbdkT5xsbB3XS5HKeaq8hkn5Zr3cg9aZ96t53B
 Xerf5w+7mUMFzINcBjAhKmSqGT0JVMaI9FS/UqxhN2cW2kA3g6RVFEvvGO/YaPzos3BNSh/xf
 MuS+WT+wiR+ZH0HSw0ZXuXQusdpIaZzKnXULYIf/kcKRXantoyjl6hKepN0RlxbsvbysABCjS
 mT2RpmHO1rlimoj2Bftp8MjAXZAOY1zpkZ+Xg1gDuUsi3q9mtaBSpAgpMJCwVrfuBXQwjs7cR
 u6g6LkAM6uID4BhrV9xdLveYh4EVNMhnhc/NSuSDSmkL2E/nK/rR7IqYQt
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75789
Cc: 75789 <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.7 (-)

Morgan Smith <morgan.j.smith@HIDDEN> writes:

> Hi Michael,

Hi Morgan,

> Apologies for the delay.  I started a new job the day after I sent this
> email!

Congrat! I wish you will fun with the new job!

>> Otherwise, it looks good to me. Please push to the debbugs repo; I'll
>> play with it for a while before making a new release.
>
> I don't believe I have push access to the repository.

I've pushed it to the git repo.

> Thanks for reviewing my patches!
>
> Morgan

Best regards, Michael.




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

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


Received: (at 75789) by debbugs.gnu.org; 10 Feb 2025 02:01:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 21:01:40 2025
Received: from localhost ([127.0.0.1]:47181 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1thJ7D-0008HQ-Rn
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2025 21:01:40 -0500
Received: from mail-mw2nam12olkn20829.outbound.protection.outlook.com
 ([2a01:111:f403:2805::829]:16224
 helo=NAM12-MW2-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <morgan.j.smith@HIDDEN>)
 id 1thJ7A-0008H9-GB
 for 75789 <at> debbugs.gnu.org; Sun, 09 Feb 2025 21:01:38 -0500
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=X1V+NzeUmc7+YwEmMoipIhIJUuY5nEyXH2/Dx9oupV/EKwYBDh1uWE39d8CcM4WoHnjkUg9lhZsceue8MBEbEekCS8ji2fyIqxchKzC6nxHwPy/F+xzZxkcMT0qmsX2cgnO6znB/5X+0ptDjs+JaVHCFXz4b13WcouIGY5LA7ENKFDsV7dqCSlowQ/1d7X2zMJFxoeqj2oOU9QW6/BCWVBNNF5zzvzdcZ+2p9FDqk4EejjlgD52Z6Tb9FQEgQ4h9PYCFgHHT3GVLyGf/zO3aWolTppSbjEecDfSYTvaV6vi7MN14vIYFRO/BPleN7zNZBSikjSZ3Ntwh636KJZxkRw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=XYc1l0vsp29Ti83kJgw0cscD/KEqdPAz9NW7olHCsZo=;
 b=ZBCWR3uNDq8qbMfH6V4YeZXTmmBxZAT8tinHgzhDFjF7WFYCta2aKYgmVyibenQT/Hpxjp6E9D0FCJqjHxL8T2qmF84mtS1Cpc/+v3k7ZbADxEtpjL/iZZ/huyefGR9IppUcdMaUK0aXgt1CVOcDaqRkgCcsFGc1QnT3CxJ/7qP2umsjT3ceee6NqD2IkwXHkrfBNJG2MEeOpeTEFwr6dZ2zGoRZT/4YQPGBZ+kE5JYLPizLjKrdhKfYyQ6hvpmz2PuxEwL/topifheZFxx8X8t/ug0TMnSPCg4JpUeHPiTxDxvBgILJiFzbPWkw1WRiYquCmI+SI0AdQpCiQYMNzg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=XYc1l0vsp29Ti83kJgw0cscD/KEqdPAz9NW7olHCsZo=;
 b=X/v3+9PQ8qp5CllKq9veYe5F383XOcvqYUc9OtDUZAfiFh355OIe3FJHSVfe8K62SvM6Ros8o6p4aif2+VWC1BQzH4+sL5vpBbhumBTxqig+GzB5pMWuQ0zBUW6wo9Tu6ui+wq1kGgyRIQNa1GigJJs1pIub8o+XP/2411MAIk9fBzL64rnojqOfDnkjBR1Si48//r6wTIAAv0QAkK3VJ/sf0YLw7sKff/ZYDS+NE30ADm5mx8Zy+VK+3pZeIK6Dk+jafOggR37eWG0rTpTI19khjN9nvyyF5pYfU3uLfEtFSQMM6ZLYfCWaQIgDSsC1OcTMESZO0Qp7dgDG19LexQ==
Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17)
 by PH7PR84MB3550.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:510:2fa::19)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8422.18; Mon, 10 Feb
 2025 02:01:28 +0000
Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM
 ([fe80::5c77:7a58:48ed:9aef]) by CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM
 ([fe80::5c77:7a58:48ed:9aef%7]) with mapi id 15.20.8422.010; Mon, 10 Feb 2025
 02:01:27 +0000
From: Morgan Smith <morgan.j.smith@HIDDEN>
To: Michael Albinus <michael.albinus@HIDDEN>
Subject: Re: bug#75789: [PATCH Debbugs] Factor cache accesses into dedicated
 functions
In-Reply-To: <874j1llupi.fsf@HIDDEN> (Michael Albinus's message of "Sun, 26
 Jan 2025 11:45:29 +0100")
References: <CH3PR84MB342425F4DDC526B5A474FC52C5E02@HIDDEN>
 <874j1llupi.fsf@HIDDEN>
X-Hashcash: 1:20:250210:michael.albinus@HIDDEN::RxJtzzsrBngu2JNL:Hak
X-Hashcash: 1:20:250210:75789 <at> debbugs.gnu.org::HbSu0ubzaLgWOjEc:3IJF
Date: Sun, 09 Feb 2025 21:01:30 -0500
Message-ID: <CH3PR84MB34244F1E4014FF6A331ED388C5F22@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
Content-Type: multipart/mixed; boundary="=-=-="
X-ClientProxiedBy: YQ1P288CA0012.CANP288.PROD.OUTLOOK.COM
 (2603:10b6:c01:9e::6) To CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM
 (2603:10b6:610:1c4::17)
X-Microsoft-Original-Message-ID: <877c5ymubp.fsf@HIDDEN>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: CH3PR84MB3424:EE_|PH7PR84MB3550:EE_
X-MS-Office365-Filtering-Correlation-Id: 373e64d5-0e19-4c6e-9c15-08dd4976d43e
X-Microsoft-Antispam: BCL:0;
 ARA:14566002|19110799003|5072599009|8060799006|6092099012|7092599003|15080799006|461199028|440099028|3412199025|13095399003|41001999003;
X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ip+BnflowohPYmdjvM69jVUWpjsHceIPE6CQf6RRPka6rayikN4g9hVordO2?=
 =?us-ascii?Q?oIVgoWaAGjKHpuAD1PVa+0bVFh/4W1Rc3P6P2IIgw8qdj1IMWVyAnkBjpnZK?=
 =?us-ascii?Q?eB/8e1H7E22WIK0C4cy44Q2qaxC0swux/5K+Zqowz4STL0b72cyeMs9HEWQ9?=
 =?us-ascii?Q?b8BbHEhETjOMC6zmIZVpQ4/fcIoHJLkwKkVyrL/TGNrs9R8X5XeyuidDQhqL?=
 =?us-ascii?Q?EFwb+R2SGeakAJNF7QyCcy43yRn+Uq0kJafg1IukLyW5IuflyV1qyiXbgnJl?=
 =?us-ascii?Q?E1+Prda6X0oo3qOz3uLShnMwI63CbGt7y+vI1Ej41amEtFfKE3h7J8kOoqLx?=
 =?us-ascii?Q?tHMWFSBLLwoQjmLYYRLm8O2qPsWUNIVVs8yY5vSPSbSYcoJJ5Hbv8HU6HRKV?=
 =?us-ascii?Q?BIzDARDjDUixWb4/x7zxVzGONRwXZY4mrbKz8mMes/hVHvNb79cavUnD9PLP?=
 =?us-ascii?Q?3FX1+7Wkq3NDOBJlSBmSOU1EozvEx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zUvbIaOGNKp2bdYQeQeBZ+b1Xb26q0mshg1Vz97BVEHRWltMGAa1wKVFhjIG?=
 =?us-ascii?Q?RD1pMo6A7VOdw34OKI1vne8Q4pgWQq/Qu1yLJNBgw2DYT8eg4aOjB4uQ+PW3?=
 =?us-ascii?Q?AXh2LAXXMvyW0HH6jUMPyE+jbLSn2xUihaP6UlSMhcPnQSWFW/kYDmqIoAEY?=
 =?us-ascii?Q?nmHXDbgvne1AmW8DLwAbGwAm8G1VD0gEbhit6g9YcJ7wmmsMWKgAUz7pP52+?=
 =?us-ascii?Q?DF63qeBrtKALkyZ4o9q+T/NjrIzN+H9sty81OCZX4HZHHeFz5wLQGfgfrL3T?=
 =?us-ascii?Q?qv6y6PjkdRDPbZ1VEk+LOopBZQ2YtyxvKDC7wBSXZg=3D=3D?=
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 373e64d5-0e19-4c6e-9c15-08dd4976d43e
X-MS-Exchange-CrossTenant-AuthSource: CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2025 02:01:27.7182 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR84MB3550
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 75789
Cc: 75789 <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 (-)

--=-=-=
Content-Type: text/plain

Michael Albinus <michael.albinus@HIDDEN> writes:

> Morgan Smith <Morgan.J.Smith@HIDDEN> writes:
>
>> Hello!
>
> Hi Morgan,
>
Hi Michael,

Apologies for the delay.  I started a new job the day after I sent this
email!

>> Just a little bit of code cleanup.  I hope this is helpful.
>>
>> You'll notice I removed a bit in `debbugs-newest-bugs' that was supposed to
>> temporarily generate a null value.  I'm not entirely certain but I don't
>> believe that actually does anything right?  Immediately after that we make a
>> synchronous soap call anyways and then return that value.
>
> I don't know. See the comment you've removed as well:
>
> --8<---------------cut here---------------start------------->8---
>> -	  ;; Due to `debbugs-gnu-completion-table', this function
>> -	  ;; could be called in rapid sequence.  We cache temporarily
>> -	  ;; the value nil, therefore.
> --8<---------------cut here---------------end--------------->8---
>
> Have you checked that this doesn't happen without the temporary
> setting?

I'm honestly still not sure.  Maybe it's a simple test but I'm still
scared of completion tables from a bad experience a few years back.
I've just made some modifications so the same logic is in place.

>
> Some few comments:
>
>> index ce6489ca39..d0aa9e87b4 100644
>> --- a/test/debbugs-tests.el
>> +++ b/test/debbugs-tests.el
>> @@ -28,6 +28,10 @@
>>
>>  (require 'debbugs)
>>
>> +;; TODO: This shouldn't be necessary but I get the error
>> +;; "(void-variable debbugs-gnu-use-threads)" without this
>> +(require 'debbugs-gnu)
>
> Oops. This is an existing bug. I will try to fix it later.
>

Thanks for fixing that!

>> +(add-function
>> + :around (symbol-function #'debbugs-get-cache)
>> + #'debbugs-test--override-float-time)
>> +
>> +(add-function
>> + :around (symbol-function #'debbugs-put-cache)
>> + #'debbugs-test--override-float-time)
>
> This is wrong as-it-is. The extended definitions of debbugs-*-cache will
> persist after running the tests. A strict rule is, that all changes must
> be reverted after running the tests.

This is being violated in the current tests by the stubbing out of
`soap-invoke-internal'.  Please see the first attached patch where I fix
this.

> I don't believe you need this. Keep the (cl-letf (((symbol-function
> #'float-time) ...))) clause in debbugs-test-get-status, and do the same
> in debbugs-test-newest-bug-cached.

I wanted a clean wrapper around the cache functions to make it easy for
future testing.  Specifically, I want to add a feature so the cache
survives an emacs restart.

> Otherwise, it looks good to me. Please push to the debbugs repo; I'll
> play with it for a while before making a new release.

I don't believe I have push access to the repository.

> Thanks, and best regards, Michael.

Thanks for reviewing my patches!

Morgan


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-tests-Call-new-setup-and-teardown-functions-in-tests.patch

From 5b0e08f4659ee871bca62987530ff13a88d3c4b5 Mon Sep 17 00:00:00 2001
From: Morgan Smith <Morgan.J.Smith@HIDDEN>
Date: Sun, 9 Feb 2025 19:51:36 -0500
Subject: [PATCH 1/2] tests: Call new setup and teardown functions in tests

* test/debbugs-tests.el:
Create new functions `debbugs-test--setup' and `debbugs-test--teardown' to be
run before and after each test.

Create new macro `ert-deftest--debbugs' to automatically call the new
functions.

Adjust tests to use the new macro
---
 test/debbugs-tests.el | 91 ++++++++++++++++++++++++++-----------------
 1 file changed, 56 insertions(+), 35 deletions(-)

diff --git a/test/debbugs-tests.el b/test/debbugs-tests.el
index ce6489ca39..8402a4fff9 100644
--- a/test/debbugs-tests.el
+++ b/test/debbugs-tests.el
@@ -89,49 +89,70 @@
           nil)
       return)))
 
-(add-function
- :override (symbol-function #'soap-invoke-internal)
- #'debbugs-test--soap-invoke-internal)
+(defun debbugs-test--setup ()
+  "Mock network and time functions.
+These mock functions are needed to make the tests reproducible."
+  (setq debbugs-test--soap-operation-name nil)
+  (setq debbugs-test--soap-parameters nil)
+
+  (add-function
+   :override (symbol-function #'soap-invoke-internal)
+   #'debbugs-test--soap-invoke-internal))
+
+(defun debbugs-test--teardown ()
+  "Restore functions to as they where before."
+  (setq debbugs-test--soap-operation-name nil)
+  (setq debbugs-test--soap-parameters nil)
+
+  (remove-function
+   (symbol-function #'soap-invoke-internal)
+   #'debbugs-test--soap-invoke-internal))
+
+(defmacro ert-deftest--debbugs (name args docstring &rest body)
+  "The same as `ert-deftest' but runs setup and teardown functions."
+  (declare
+   (doc-string 3)
+   (indent 2))
+  `(ert-deftest ,name ,args ,docstring
+                (debbugs-test--setup)
+                ,@body
+                (debbugs-test--teardown)))
 
 ;;; Tests:
 
-(ert-deftest debbugs-test-get-bugs ()
+(ert-deftest--debbugs debbugs-test-get-bugs ()
   "Test \"get_bugs\"."
-  (let (debbugs-test--soap-operation-name debbugs-test--soap-parameters)
-    (debbugs-get-bugs
-     :tag "patch"
-     :severity "critical"
-     :status "open"
-     :status "forwarded")
-    (should (string-equal debbugs-test--soap-operation-name "get_bugs"))
-    (should (equal debbugs-test--soap-parameters
-                   '(["tag" "patch" "severity" "critical"
-                      "status" "open" "status" "forwarded"])))))
-
-(ert-deftest debbugs-test-newest-bugs ()
+  (debbugs-get-bugs
+   :tag "patch"
+   :severity "critical"
+   :status "open"
+   :status "forwarded")
+  (should (string-equal debbugs-test--soap-operation-name "get_bugs"))
+  (should (equal debbugs-test--soap-parameters
+                 '(["tag" "patch" "severity" "critical"
+                    "status" "open" "status" "forwarded"]))))
+
+(ert-deftest--debbugs debbugs-test-newest-bugs ()
   "Test \"newest_bugs\"."
-  (let (debbugs-test--soap-operation-name debbugs-test--soap-parameters)
-    (debbugs-newest-bugs 4)
-    (should (string-equal debbugs-test--soap-operation-name "newest_bugs"))
-    (should (equal debbugs-test--soap-parameters '(4)))))
+  (debbugs-newest-bugs 4)
+  (should (string-equal debbugs-test--soap-operation-name "newest_bugs"))
+  (should (equal debbugs-test--soap-parameters '(4))))
 
-(ert-deftest debbugs-test-get-status ()
+(ert-deftest--debbugs debbugs-test-get-status ()
   "Test \"get_status\"."
-  (let (debbugs-test--soap-operation-name debbugs-test--soap-parameters)
-    (cl-letf (((symbol-function #'float-time)
-               (lambda (&optional _specified-time) 5000)))
-      (should (= (float-time) 5000))
-      (should (equal (sort (car (debbugs-get-status 64064)))
-                     (sort (car debbugs-test--bug-status))))
-      (should (string-equal debbugs-test--soap-operation-name "get_status"))
-      (should (equal debbugs-test--soap-parameters '([64064]))))))
-
-(ert-deftest debbugs-test-get-usertag ()
+  (cl-letf (((symbol-function #'float-time)
+             (lambda (&optional _specified-time) 5000)))
+    (should (= (float-time) 5000))
+    (should (equal (sort (car (debbugs-get-status 64064)))
+                   (sort (car debbugs-test--bug-status))))
+    (should (string-equal debbugs-test--soap-operation-name "get_status"))
+    (should (equal debbugs-test--soap-parameters '([64064])))))
+
+(ert-deftest--debbugs debbugs-test-get-usertag ()
   "Test \"get_usertag\"."
-  (let (debbugs-test--soap-operation-name debbugs-test--soap-parameters)
-    (should (equal (debbugs-get-usertag :user "emacs") '("hi")))
-    (should (string-equal debbugs-test--soap-operation-name "get_usertag"))
-    (should (equal debbugs-test--soap-parameters '("emacs")))))
+  (should (equal (debbugs-get-usertag :user "emacs") '("hi")))
+  (should (string-equal debbugs-test--soap-operation-name "get_usertag"))
+  (should (equal debbugs-test--soap-parameters '("emacs"))))
 
 (provide 'debbugs-tests)
 
-- 
2.48.1


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0002-Factor-cache-accesses-into-dedicated-functions.patch

From 7bc3aa8a32a0185400423504a15368b3865d1ca3 Mon Sep 17 00:00:00 2001
From: Morgan Smith <Morgan.J.Smith@HIDDEN>
Date: Wed, 22 Jan 2025 18:19:13 -0500
Subject: [PATCH 2/2] Factor cache accesses into dedicated functions

* debbugs.el (debbugs-get-cache, debbugs-put-cache): New functions.
(debbugs-newest-bugs, debbugs-get-status): Use new functions.

* test/debbugs-tests.el: Use advice to set the `cache_time' around the new
functions.
(debbugs-test-newest-bug-cached): New test.
(debbugs-test-get-status): Add test for caching behavior.
---
 debbugs.el            | 107 ++++++++++++++++++++++--------------------
 test/debbugs-tests.el |  57 ++++++++++++++++++----
 2 files changed, 103 insertions(+), 61 deletions(-)

diff --git a/debbugs.el b/debbugs.el
index 5ab1dfc4ba..dd9b6dc09f 100644
--- a/debbugs.el
+++ b/debbugs.el
@@ -118,6 +118,33 @@ t or 0 disables caching, nil disables expiring."
 		 (const :tag "Forever" nil)
 		 (integer :tag "Seconds")))
 
+(defun debbugs-get-cache (bug-number)
+  "Return the cached status entry for the bug identified by BUG-NUMBER."
+  (let ((status (gethash bug-number debbugs-cache-data)))
+    (when (and status
+               (or (null debbugs-cache-expiry)
+                   (and
+                    (natnump debbugs-cache-expiry)
+                    (> (alist-get 'cache_time status)
+                       (- (float-time) debbugs-cache-expiry)))))
+      status)))
+
+(defun debbugs-put-cache (bug-number status &optional ttl)
+  "Put the STATUS entry for the bug BUG-NUMBER in the cache.
+Return STATUS."
+  (if (or (null debbugs-cache-expiry)
+          (and (natnump debbugs-cache-expiry)
+               (not (zerop debbugs-cache-expiry))))
+      (let ((cache-time (float-time)))
+        ;; Kind of a hack for TTL that assume that `debbugs-cache-expiry'
+        ;; doesn't change
+        (when (and ttl (natnump debbugs-cache-expiry))
+          (setq cache-time (+ ttl (- cache-time debbugs-cache-expiry))))
+        (puthash bug-number
+                 (cons (cons 'cache_time cache-time) status)
+                 debbugs-cache-data))
+    status))
+
 (defun debbugs-soap-invoke (operation-name &rest parameters)
   "Invoke the SOAP connection.
 OPERATION-NAME and PARAMETERS are as described in `soap-invoke'."
@@ -325,41 +352,29 @@ patch:
 (defun debbugs-newest-bugs (amount)
   "Return the list of bug numbers, according to AMOUNT (a number) latest bugs."
   (if (= amount 1)
-      ;; We cache it as bug "0" in `debbugs-cache-data'.
-      (let ((status (gethash 0 debbugs-cache-data)))
-	(unless (and
-		 status
-		 (or
-		  (null debbugs-cache-expiry)
-		  (and
-		   (natnump debbugs-cache-expiry)
-		   (> (alist-get 'cache_time status)
-		      (- (float-time) debbugs-cache-expiry)))))
-	  ;; Due to `debbugs-gnu-completion-table', this function
-	  ;; could be called in rapid sequence.  We cache temporarily
-	  ;; the value nil, therefore.
-	  (when (natnump debbugs-cache-expiry)
-	    (puthash
-	     0
-	     (list (cons 'cache_time (1+ (- (float-time) debbugs-cache-expiry)))
-		   (list 'newest_bug))
-	     debbugs-cache-data))
-	  ;; Compute the value.
-	  (setq
-	   status
-	   (list
-	    (cons 'cache_time (float-time))
-	    (cons 'newest_bug
-		  (caar
-		   (debbugs-soap-invoke
-		    debbugs-wsdl debbugs-port "newest_bugs" amount)))))
-
-	  ;; Cache it.
-	  (when (or (null debbugs-cache-expiry) (natnump debbugs-cache-expiry))
-	    (puthash 0 status debbugs-cache-data)))
-
-	;; Return the value, as list.
-	(list (alist-get 'newest_bug status)))
+      ;; We cache it as bug "0"
+      (let ((status (debbugs-get-cache 0)))
+        (unless status
+          ;; Due to `debbugs-gnu-completion-table', this function
+          ;; could be called in rapid sequence.  We cache temporarily
+          ;; the value nil, therefore.
+          (when (natnump debbugs-cache-expiry)
+            (debbugs-put-cache 0 (list 'newest_bug) 1))
+
+          ;; Compute the value.
+          (setq
+           status
+           (list
+            (cons 'newest_bug
+                  (caar
+                   (debbugs-soap-invoke
+                    debbugs-wsdl debbugs-port "newest_bugs" amount)))))
+
+          ;; Cache it.
+          (debbugs-put-cache 0 status))
+
+        ;; Return the value, as list.
+        (list (alist-get 'newest_bug status)))
 
     (sort
      (car (debbugs-soap-invoke
@@ -477,15 +492,8 @@ Example:
 	  (delq nil
 	   (mapcar
 	    (lambda (bug)
-	      (let ((status (gethash bug debbugs-cache-data)))
-		(if (and
-		     status
-		     (or
-		      (null debbugs-cache-expiry)
-		      (and
-		       (natnump debbugs-cache-expiry)
-		       (> (alist-get 'cache_time status)
-			  (- (float-time) debbugs-cache-expiry)))))
+	      (let ((status (debbugs-get-cache bug)))
+		(if status
 		    (progn
 		      (setq cached-bugs (append cached-bugs (list status)))
 		      nil)
@@ -582,14 +590,9 @@ Example:
 	    (when (stringp (cdr y))
 	      (setcdr y (split-string (cdr y) ",\\| " t))))
 	  ;; Cache the result, and return.
-	  (if (or (null debbugs-cache-expiry) (natnump debbugs-cache-expiry))
-	      (puthash
-	       (alist-get 'key x)
-	       ;; Put also a time stamp.
-	       (cons (cons 'cache_time (float-time)) (alist-get 'value x))
-	       debbugs-cache-data)
-	    ;; Don't cache.
-	    (alist-get 'value x))))
+      (debbugs-put-cache
+       (alist-get 'key x)
+       (alist-get 'value x))))
       debbugs-soap-invoke-async-object))))
 
 (defun debbugs-get-usertag (&rest query)
diff --git a/test/debbugs-tests.el b/test/debbugs-tests.el
index 8402a4fff9..f3abea2837 100644
--- a/test/debbugs-tests.el
+++ b/test/debbugs-tests.el
@@ -89,6 +89,12 @@
           nil)
       return)))
 
+(defun debbugs-test--override-float-time (func &rest rest)
+  "Override `float-time' for FUNC with args REST."
+  (cl-letf (((symbol-function #'float-time)
+             (lambda (&optional _specified-time) 5000)))
+    (apply func rest)))
+
 (defun debbugs-test--setup ()
   "Mock network and time functions.
 These mock functions are needed to make the tests reproducible."
@@ -97,7 +103,15 @@ These mock functions are needed to make the tests reproducible."
 
   (add-function
    :override (symbol-function #'soap-invoke-internal)
-   #'debbugs-test--soap-invoke-internal))
+   #'debbugs-test--soap-invoke-internal)
+
+  (add-function
+   :around (symbol-function #'debbugs-get-cache)
+   #'debbugs-test--override-float-time)
+
+  (add-function
+   :around (symbol-function #'debbugs-put-cache)
+   #'debbugs-test--override-float-time))
 
 (defun debbugs-test--teardown ()
   "Restore functions to as they where before."
@@ -106,7 +120,15 @@ These mock functions are needed to make the tests reproducible."
 
   (remove-function
    (symbol-function #'soap-invoke-internal)
-   #'debbugs-test--soap-invoke-internal))
+   #'debbugs-test--soap-invoke-internal)
+
+  (remove-function
+   (symbol-function #'debbugs-get-cache)
+   #'debbugs-test--override-float-time)
+
+  (remove-function
+   (symbol-function #'debbugs-put-cache)
+   #'debbugs-test--override-float-time))
 
 (defmacro ert-deftest--debbugs (name args docstring &rest body)
   "The same as `ert-deftest' but runs setup and teardown functions."
@@ -138,15 +160,32 @@ These mock functions are needed to make the tests reproducible."
   (should (string-equal debbugs-test--soap-operation-name "newest_bugs"))
   (should (equal debbugs-test--soap-parameters '(4))))
 
+(ert-deftest--debbugs debbugs-test-newest-bug-cached ()
+  "Test getting the newest bug from the cache."
+  ;; First time we get it from the server.
+  (should (equal (debbugs-newest-bugs 1) '(0)))
+  (should (equal debbugs-test--soap-operation-name "newest_bugs"))
+  (should (equal debbugs-test--soap-parameters '(1)))
+  (setq debbugs-test--soap-operation-name nil)
+  (setq debbugs-test--soap-parameters nil)
+  ;; Now it's cached
+  (should (equal (debbugs-newest-bugs 1) '(0)))
+  (should (equal debbugs-test--soap-operation-name nil))
+  (should (equal debbugs-test--soap-parameters nil)))
+
 (ert-deftest--debbugs debbugs-test-get-status ()
   "Test \"get_status\"."
-  (cl-letf (((symbol-function #'float-time)
-             (lambda (&optional _specified-time) 5000)))
-    (should (= (float-time) 5000))
-    (should (equal (sort (car (debbugs-get-status 64064)))
-                   (sort (car debbugs-test--bug-status))))
-    (should (string-equal debbugs-test--soap-operation-name "get_status"))
-    (should (equal debbugs-test--soap-parameters '([64064])))))
+  (should (equal (sort (car (debbugs-get-status 64064)))
+                 (sort (car debbugs-test--bug-status))))
+  (should (string-equal debbugs-test--soap-operation-name "get_status"))
+  (should (equal debbugs-test--soap-parameters '([64064])))
+  (setq debbugs-test--soap-operation-name nil)
+  (setq debbugs-test--soap-parameters nil)
+  ;; cached
+  (should (equal (sort (car (debbugs-get-status 64064)))
+                 (sort (car debbugs-test--bug-status))))
+  (should (equal debbugs-test--soap-operation-name nil))
+  (should (equal debbugs-test--soap-parameters nil)))
 
 (ert-deftest--debbugs debbugs-test-get-usertag ()
   "Test \"get_usertag\"."
-- 
2.48.1


--=-=-=--




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

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


Received: (at 75789) by debbugs.gnu.org; 27 Jan 2025 17:13:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 12:13:15 2025
Received: from localhost ([127.0.0.1]:34316 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tcSfi-0006XZ-NJ
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2025 12:13:15 -0500
Received: from mout.gmx.net ([212.227.17.21]:59947)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael.albinus@HIDDEN>)
 id 1tcSff-0006XK-Mt
 for 75789 <at> debbugs.gnu.org; Mon, 27 Jan 2025 12:13:13 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de;
 s=s31663417; t=1737997985; x=1738602785; i=michael.albinus@HIDDEN;
 bh=DvrV7aUzhpoUVMI6VtpKNQivWu5yqcXvbFtRUXZl7tE=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding:
 content-type:date:from:message-id:mime-version:reply-to:subject:
 to;
 b=CbvUVUIHXsyoXv9pjrhQU41LFhGx0fkL+x6VOdA/BuiY6ACKui9+o1nkraeshteS
 LD4QdMrBwaxOlquiVeLM1Zktzovq/vZ+h9MwtlXIhPYbG7p+dRA4Nk+YKHIpklj0u
 61ASr6o0W2g+nWsDl3iZpxBxlpNlLrb/vxA27VRYnPybXU+lBxszXfos/D25QK3Ra
 +8nIFGNk4oacu8yMkhjoZfytKtdz3+rPxXRvU7ssgXWe+RfgdaYTnrrzisjbUEUiq
 IjZrxAB4MnReILc2ytDLjOUBwrfWipMUan/dKj/SEidRVo76OVaeh6XERSTWAanQU
 LYkmExf545bQKjXSmw==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx104
 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MSc1B-1u4oNk13Yf-00OfP5; Mon, 27
 Jan 2025 18:13:05 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Morgan Smith <Morgan.J.Smith@HIDDEN>
Subject: Re: bug#75789: [PATCH Debbugs] Factor cache accesses into dedicated
 functions
In-Reply-To: <874j1llupi.fsf@HIDDEN> (Michael Albinus's message of "Sun, 26
 Jan 2025 11:45:29 +0100")
References: <CH3PR84MB342425F4DDC526B5A474FC52C5E02@HIDDEN>
 <874j1llupi.fsf@HIDDEN>
Date: Mon, 27 Jan 2025 18:13:01 +0100
Message-ID: <87a5bcmb8i.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:QLUHRY7BuFpXDY1SglJfpLPQAwlYmIYnpUPjBfPXKOiJhrlJ4lR
 97KptTAPqh93vUt1KXO0KDnaUu4/MrXcF/cq1z7/h2/2jJJG8Cd5lxnFm+auiJnz3mo2H8T
 v4yZefas3/z9C2rOkcf61ABSHOeRgbqcbp6Zdqz5VbWnpC+mGNEfOZ8h7+NXhIhVuiyRK0T
 0XPtYCPhItCIOroJhNRQA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:wtexb51KSR8=;pFv5ud2qsJ43ceyLKCKUc4KK/tJ
 UYTWmi0CTsDCjWP/APrZxwOAgiSqBbfl26pmmc+tW8XdGsSetIYIkCvM2oTkYXfrKXn1xIRxE
 eTNmYNMsdh8I3VprVoyY0xO8WdL3t6OxXZ7UQGk0mEMjPsxNqMFgmAZTPxcyK0tJQm2dP7gqu
 e2RvEVvHebF2YyT8uBmobzb1DjSZEZNQ2M9AVzql4RT8Z38iNJn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ugs-Envelope-To: 75789
Cc: 75789 <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.7 (-)

Michael Albinus <michael.albinus@HIDDEN> writes:

Hi Morgan,

>> +;; TODO: This shouldn't be necessary but I get the error
>> +;; "(void-variable debbugs-gnu-use-threads)" without this
>> +(require 'debbugs-gnu)
>
> Oops. This is an existing bug. I will try to fix it later.

This is fixed now in the git repo. You don't need to require debbugs-gnu anymore.

Best regards, Michael.




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

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


Received: (at 75789) by debbugs.gnu.org; 26 Jan 2025 10:45:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 05:45:46 2025
Received: from localhost ([127.0.0.1]:54832 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tc09C-0008Fd-1E
	for submit <at> debbugs.gnu.org; Sun, 26 Jan 2025 05:45:46 -0500
Received: from mout.gmx.net ([212.227.15.18]:53065)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <michael.albinus@HIDDEN>)
 id 1tc098-0008FH-Pj
 for 75789 <at> debbugs.gnu.org; Sun, 26 Jan 2025 05:45:44 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de;
 s=s31663417; t=1737888336; x=1738493136; i=michael.albinus@HIDDEN;
 bh=0oRU1xoUtrZfX7rUf1UixsMwKyww3Cgjek2IS4na+/c=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date:
 Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc:
 content-transfer-encoding:content-type:date:from:message-id:
 mime-version:reply-to:subject:to;
 b=cEnnxWqQ3oowobKFtQRvJ1pGLWDO/18aXSUjAXIn8c6Odi+j0Hk09W7OWaU7WeJz
 RQ8IBP193gElIcfD+ijJngIpQIKyavKcOoGFlqnALg/5qbH8emk66R26pK22TR3ag
 rNXF3nzHCEdca1HnQ5p1/W/kAYQMaVeKTJT37mbrbVJoUaFR74/KkECMCAQrTnFas
 KPE9HxcEPSkGnSCVmO6ycPcHJgpB9oWWKmZT5Vm7Tb/NNkvRNcw92YnjeetLl3dk+
 SzRLv7uyM635mi/yU2FqVk0DQ11Fxi7sK6yy5FoGYp1UHuG9RlKTXoiBa082OI0Av
 6FrL/AbEyrk88s8ikw==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from gandalf.gmx.de ([185.89.38.155]) by mail.gmx.net (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MLi8g-1ttfWK1PvM-00RQpa; Sun, 26
 Jan 2025 11:45:36 +0100
From: Michael Albinus <michael.albinus@HIDDEN>
To: Morgan Smith <Morgan.J.Smith@HIDDEN>
Subject: Re: bug#75789: [PATCH Debbugs] Factor cache accesses into dedicated
 functions
In-Reply-To: <CH3PR84MB342425F4DDC526B5A474FC52C5E02@HIDDEN>
 (Morgan Smith's message of "Thu, 23 Jan 2025 13:22:18 -0500")
References: <CH3PR84MB342425F4DDC526B5A474FC52C5E02@HIDDEN>
Date: Sun, 26 Jan 2025 11:45:29 +0100
Message-ID: <874j1llupi.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:83IQ9ashUtuK5ruXkS9sIBCdJwpcj/LhZ2jnocB96A5a5eMKazi
 PbtSkQdLALgsQoUSBNgxvldBgviGIy+fS7vAn9PAJrNo/sMVrK+2ZF6Adzd0urFCHXv61zH
 11qBk8K6QWme1yekCt6x+OdsVB3lRLAGl78UevOJQjYZ2X5fGDQvtuC6bpKT9Kb9NearTGc
 14fL+SnUv3FRx0jGThD0g==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:SHa7RtqCWvw=;ix77M9GSjO6aeXu4CW0W2jqv6eI
 U7cSgHy+pyb5N5qftqJ4I0n+7OEbYLj1D4YeTfYTkOeqFTroqeXtgRQZEkm+WQfT1ZsMJY5I5
 W1ErxYnNCub+Be75K0eWyZPQKHM7FqstZJ300jjlAVMpYy/aG08D+x7zp6mv9UoBJxOIFIe22
 auOhOb3Wdmd42410aTHOYUhNKDLM+rvNCXLqak4LpQN2qyUVT94k9CxnjzBM7FMRibKOeHBJ1
 ulpDV8swkYEqszqh6pWYnXwFE9uglGl3upcdffJygj8xVAFsluLA8muIQBnx6N+UAAt9gq7IY
 z6bUarcj93PgBKismREDhIN/RKrMpeE0tLaxbB4I7uFLhnnGJZ3at4gVpkya/qKLjRDu/y4NF
 tWuC9pJ6/N9xCYUPWCx95iE9yH1qi7Zpe4a2eCML00LRkqeuB8z0VAe3Yo246sYhrM8qlJMWy
 jdKZv9fsHNYCnRz6e8ItOQELzIVm7vUxMcx7taxtFI73h10fKGAR0qxA1I5Dll3Ony8Gfjc25
 rUsMDNKWtWVHATeYOrbLjvZZZs6MAtPsVpp4qYUX9xDKx2e2neK0aWmSli8e/Q51NrUOsXVOn
 G20q+I3XwXivrOc8GEy3M06nb3EE4tOd9U+J+cSH6UyWKw3Eus05lUyVsEqGhSJc/+Wv4R6w9
 R8sBeJ0gPeS2kFy30bxphRgDhj6npBgCW7nKKbw2uOwkMsR/pwktLI7nz/+rVcpC5eCqHYSz9
 /NjkiugLot3+gZBx5zws3mqkzjM01iU70zPDe/RgJH+lUtAF8pVdNNGsCCkOoMpcqWbWJ31T4
 vR25m0nnyaq3UaWLruWtASGzpdGv3kY5NEb/wA0WVzt1wLbUPeAw1OhmLMUwmT6vSdPoGP++Y
 ugHULKZuvOhsQQRHH0JEtlFlqxZfAe0SmA6oS6CiCRN0UWDWdc4dSwx1iR3GhRz0gMVZXXtP0
 DXjt+kTC188wQrxx2r2km6/FaADl7bir3PYKLfHWji03OHF4WTlTWHdAlvTye/9NtMhGnmEmy
 dhaCh1nzK697ZxkPmWlLIGx4o9pqvW69xjC4Es1MKVBwa3sWRFdey8fnzfzLyCMdHCdIiq//X
 buOSjdxHEO6BD0aUfwu/HmCq186V6qJVGgz/w2dAxJiOvPQP+zZ+acsNHiacFqVGG6ypeXGgB
 VCU4OHTbETaCAFJ5+arJieLywKue2DbXIe11LnJrAr9kb0u76md3GgLyvd46S/b57D0xgJPHx
 XwXma6hP6tdM4OedYpQKycoFETlzy29HMI6PQGrLjsHBC0HRBL0n06LV5pp44CiiAonFkGEfX
 CS/Se1lFyrrrs5oZnZ+Y/U6qUQ96nq4Z+ylZZmJ7c5w2Ks=
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 75789
Cc: 75789 <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.7 (-)

Morgan Smith <Morgan.J.Smith@HIDDEN> writes:

> Hello!

Hi Morgan,

> Just a little bit of code cleanup.  I hope this is helpful.
>
> You'll notice I removed a bit in `debbugs-newest-bugs' that was supposed=
 to
> temporarily generate a null value.  I'm not entirely certain but I don't
> believe that actually does anything right?  Immediately after that we ma=
ke a
> synchronous soap call anyways and then return that value.

I don't know. See the comment you've removed as well:

=2D-8<---------------cut here---------------start------------->8---
> -	  ;; Due to `debbugs-gnu-completion-table', this function
> -	  ;; could be called in rapid sequence.  We cache temporarily
> -	  ;; the value nil, therefore.
=2D-8<---------------cut here---------------end--------------->8---

Have you checked that this doesn't happen without the temporary setting?

Some few comments:

> index ce6489ca39..d0aa9e87b4 100644
> --- a/test/debbugs-tests.el
> +++ b/test/debbugs-tests.el
> @@ -28,6 +28,10 @@
>
>  (require 'debbugs)
>
> +;; TODO: This shouldn't be necessary but I get the error
> +;; "(void-variable debbugs-gnu-use-threads)" without this
> +(require 'debbugs-gnu)

Oops. This is an existing bug. I will try to fix it later.

> +(add-function
> + :around (symbol-function #'debbugs-get-cache)
> + #'debbugs-test--override-float-time)
> +
> +(add-function
> + :around (symbol-function #'debbugs-put-cache)
> + #'debbugs-test--override-float-time)

This is wrong as-it-is. The extended definitions of debbugs-*-cache will
persist after running the tests. A strict rule is, that all changes must
be reverted after running the tests.

I don't believe you need this. Keep the (cl-letf (((symbol-function
#'float-time) ...))) clause in debbugs-test-get-status, and do the same
in debbugs-test-newest-bug-cached.

Otherwise, it looks good to me. Please push to the debbugs repo; I'll
play with it for a while before making a new release.

Thanks, and best regards, Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75789; Package emacs. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 23 Jan 2025 18:34:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 23 13:34:05 2025
Received: from localhost ([127.0.0.1]:42335 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tb21l-0005h4-2N
	for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 13:34:05 -0500
Received: from lists.gnu.org ([2001:470:142::17]:43240)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <Morgan.J.Smith@HIDDEN>)
 id 1tb21i-0005gR-1g
 for submit <at> debbugs.gnu.org; Thu, 23 Jan 2025 13:34:03 -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 <Morgan.J.Smith@HIDDEN>)
 id 1tb21V-0007Ln-8S
 for bug-gnu-emacs@HIDDEN; Thu, 23 Jan 2025 13:33:49 -0500
Received: from mail-bn8nam12olkn2081a.outbound.protection.outlook.com
 ([2a01:111:f403:2c18::81a]
 helo=NAM12-BN8-obe.outbound.protection.outlook.com)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Morgan.J.Smith@HIDDEN>)
 id 1tb21S-0003UW-Tu
 for bug-gnu-emacs@HIDDEN; Thu, 23 Jan 2025 13:33:48 -0500
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=IgYNK5/v4E/6WwZp+/n9RIuCNiDoCbYlK8fIEF4XnXgHPygbYg2jz83FERcTZyG3cjwulNDPDBz9iuNZpfQqf0CTsQ7LQdzqJYPlfBe5nrbuVxLzs175wKoFx+1lSyJnTEiJZYUhDZNz17qVL2wLW2ZQxpAAe+62o1WXN3JEeyX9DGV1QFUuW7S6HSctae4HTr3HvXFMrfKOK/9upGMl3ooi69jVMcgkuEWDcxdqgjeS+r9Xepu6nqvsnkfW1g2TbYyG01LJKDy2r/nrE+VZ526qojTiDMrrB742FKi8es5uS0woAItmG0AV5gSWXAQtmyvWVlst5oqK2IXeGPMvHA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector10001;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=zXQh28F5PmCpsYpiUxFJ65uYn5T2jkNUsGXBzNvxSAI=;
 b=Y2Z+cf5HicpbABFm/arYmDyqAuD3Jxqji1zhaIa/41yoCKt/7Hfspe5gRzK7kj5d5z6O6KlDVkSQTwIjHDH24cKWrs6XLVNE0keWp28Ism4oUlMxJld3Cbs5VuHYS925f7nQB0Kfu/xB7bdtXqWE1TNw39gmtogyLTqTCFsVPOu+q0X1yfp7Vk4JWi2Uvie7/Lyyl6ituJGwBARKDEKI5Qb/2nBA0di8hAL7ixtFidNfZP5LtKgxXjYvLidGiQA5dXH3AYZyPl5kJqlxnX4rA/GWBoxAqfr0MhcUVgyR4VHZGRWAbc3yh+cY1ToOB9RPhYS2m26gGzycq//rAGHYCQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
 dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=zXQh28F5PmCpsYpiUxFJ65uYn5T2jkNUsGXBzNvxSAI=;
 b=QtY4E7ZsODjW6QqU8nl4t2/rGRF6h6m9nXo1cpDw/RAPe6nRmdxOliM+AD8Sq/Xjb8KZ2wA3il2M3aVsGUG33XNWgLVUW2O0r1DB3Xoj8f8TWWwW0gPVWtrVegIgSvs/mCHij7PR4t4hiJkHIFQN0ES6y53tA+sRXfwoY8tRgeEOHtx7QIFuA7Gf3Ghi3NuCoDZb9LD7uIgfpMgjfmCKPBuCsRoiRzfd5ih8NFjv9s0sNGIm0XsEpsceAqMfNz4btaRxcvWbo9CWXYEZc4XegR7uI6f1UCzU9+OzDeT3VOeSPDYA7ipOo1NoQclaao7x8atzKN6FGBjUHvDbICznbg==
Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:610:1c4::17)
 by PH0PR84MB1478.NAMPRD84.PROD.OUTLOOK.COM (2603:10b6:510:171::21)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.16; Thu, 23 Jan
 2025 18:28:41 +0000
Received: from CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM
 ([fe80::5c77:7a58:48ed:9aef]) by CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM
 ([fe80::5c77:7a58:48ed:9aef%7]) with mapi id 15.20.8356.020; Thu, 23 Jan 2025
 18:28:41 +0000
From: Morgan Smith <Morgan.J.Smith@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH Debbugs] Factor cache accesses into dedicated functions
Date: Thu, 23 Jan 2025 13:22:18 -0500
Message-ID: <CH3PR84MB342425F4DDC526B5A474FC52C5E02@HIDDEN>
X-Mailer: git-send-email 2.47.1
X-Debbugs-Cc: Michael Albinus <michael.albinus@HIDDEN>
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-ClientProxiedBy: YT1P288CA0024.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01::37)
 To CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM
 (2603:10b6:610:1c4::17)
X-Microsoft-Original-Message-ID: <20250123182217.24448-2-Morgan.J.Smith@HIDDEN>
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: CH3PR84MB3424:EE_|PH0PR84MB1478:EE_
X-MS-Office365-Filtering-Correlation-Id: bffe0ac8-808c-4e7b-c084-08dd3bdbc2f2
X-Microsoft-Antispam: BCL:0;
 ARA:14566002|461199028|5072599009|7092599003|19110799003|15080799006|8060799006|440099028|3412199025|41001999003|1710799026;
X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rBHRX/QT/d2JcQjRW8+6o4ODuFs7Vl0duJY4WNhnsjFiwYShFEIyNDGLEFWu?=
 =?us-ascii?Q?7F+IyB/XJy8fXItK6xT+mt1zMKFER6BNtlSkpCuHAb7oDrOTjHhzuDqs0R9A?=
 =?us-ascii?Q?15kp6MihLniB2Gh+mYGicfKS66gaLceoJTdeQmssuux7L4wz5+kd16zxkXTi?=
 =?us-ascii?Q?vYeKPkDzyqkzcF3qMLeoifPPkHc//15iCS43ssK8zHXR49Pg8JdZ4oYNeJ7X?=
 =?us-ascii?Q?gR9rPOHuUR+huQUiM1mByAyT8lsxMMnoQgfwRDP6x423B/jCQV8EyRcnUVsD?=
 =?us-ascii?Q?91ifCotz5qrlMT3GXZupPa3kMjfXNgqnyAoAdhRNoJNPSKQJIsD71laLOFGH?=
 =?us-ascii?Q?4lFjdgNAovNqT6C1zhV8pQO3wBKrCfha2wkonGA9MQMecl+ertevbJdR4and?=
 =?us-ascii?Q?WZ/rWsNk6RQNu9rvok3YvV1UJOV+XTRVJUYt4bVHBO2rDIYyF+/Z2kAAaLXN?=
 =?us-ascii?Q?ae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cRQbNPIPMMX?=
 =?us-ascii?Q?RxDcKTmn3xpk3VJ5JAyppGHf1oCLqk8i+WiYvJC6UWAyuqg7oz2rGwoynQKk?=
 =?us-ascii?Q?z6mluvk8LfFejirDl6nnDORLh4GAxb7+rqnyR9j4eZubl1czvvisJrrPM2wA?=
 =?us-ascii?Q?msS/fXoBVCbRk/z989vnq4QL9F/fTCTWfzYAS+S0rcCseT28SwYxPnEwApa6?=
 =?us-ascii?Q?WMZMUqvvwzaq5rsydf89vik8P9TKl3tNg3CsXnfp/OgzdHl31G1Dz7Kyht4d?=
 =?us-ascii?Q?W8nkDpgtG9b4zGeQy2V62v4t4aaV5+lqvmNO7Ugd5hgLw77FZWq5wx+4IVCe?=
 =?us-ascii?Q?NYMqoto1PelQlb3/VCZu?=
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: bffe0ac8-808c-4e7b-c084-08dd3bdbc2f2
X-MS-Exchange-CrossTenant-AuthSource: CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2025 18:28:41.4556 (UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR84MB1478
Received-SPF: pass client-ip=2a01:111:f403:2c18::81a;
 envelope-from=Morgan.J.Smith@HIDDEN;
 helo=NAM12-BN8-obe.outbound.protection.outlook.com
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,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: Morgan Smith <Morgan.J.Smith@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.0 (/)

* debbugs.el (debbugs-get-cache, debbugs-put-cache): New functions.
(debbugs-newest-bugs, debbugs-get-status): Use new functions.

* test/debbugs-tests.el: Use advice to set the `cache_time' around the new
functions.
(debbugs-test-newest-bug-cached): New test.
(debbugs-test-get-status): Add test for caching behavior.
---

Hello!

Just a little bit of code cleanup.  I hope this is helpful.

You'll notice I removed a bit in `debbugs-newest-bugs' that was supposed to
temporarily generate a null value.  I'm not entirely certain but I don't
believe that actually does anything right?  Immediately after that we make a
synchronous soap call anyways and then return that value.

 debbugs.el            | 80 +++++++++++++++++++------------------------
 test/debbugs-tests.el | 50 +++++++++++++++++++++++----
 2 files changed, 79 insertions(+), 51 deletions(-)

diff --git a/debbugs.el b/debbugs.el
index 5ab1dfc4ba..36fdca8ff0 100644
--- a/debbugs.el
+++ b/debbugs.el
@@ -118,6 +118,28 @@ t or 0 disables caching, nil disables expiring."
 		 (const :tag "Forever" nil)
 		 (integer :tag "Seconds")))
 
+(defun debbugs-get-cache (bug-number)
+  "Return the cached status entry for the bug identified by BUG-NUMBER."
+  (let ((status (gethash bug-number debbugs-cache-data)))
+    (when (and status
+               (or (null debbugs-cache-expiry)
+                   (and
+                    (natnump debbugs-cache-expiry)
+                    (> (alist-get 'cache_time status)
+                       (- (float-time) debbugs-cache-expiry)))))
+      status)))
+
+(defun debbugs-put-cache (bug-number status)
+  "Put the STATUS entry for the bug BUG-NUMBER in the cache.
+Return STATUS."
+  (if (or (null debbugs-cache-expiry)
+          (and (natnump debbugs-cache-expiry)
+               (not (zerop debbugs-cache-expiry))))
+      (puthash bug-number
+               (cons (cons 'cache_time (float-time)) status)
+               debbugs-cache-data)
+    status))
+
 (defun debbugs-soap-invoke (operation-name &rest parameters)
   "Invoke the SOAP connection.
 OPERATION-NAME and PARAMETERS are as described in `soap-invoke'."
@@ -325,38 +347,20 @@ patch:
 (defun debbugs-newest-bugs (amount)
   "Return the list of bug numbers, according to AMOUNT (a number) latest bugs."
   (if (= amount 1)
-      ;; We cache it as bug "0" in `debbugs-cache-data'.
-      (let ((status (gethash 0 debbugs-cache-data)))
-	(unless (and
-		 status
-		 (or
-		  (null debbugs-cache-expiry)
-		  (and
-		   (natnump debbugs-cache-expiry)
-		   (> (alist-get 'cache_time status)
-		      (- (float-time) debbugs-cache-expiry)))))
-	  ;; Due to `debbugs-gnu-completion-table', this function
-	  ;; could be called in rapid sequence.  We cache temporarily
-	  ;; the value nil, therefore.
-	  (when (natnump debbugs-cache-expiry)
-	    (puthash
-	     0
-	     (list (cons 'cache_time (1+ (- (float-time) debbugs-cache-expiry)))
-		   (list 'newest_bug))
-	     debbugs-cache-data))
+      ;; We cache it as bug "0"
+      (let ((status (debbugs-get-cache 0)))
+	(unless status
 	  ;; Compute the value.
 	  (setq
 	   status
-	   (list
-	    (cons 'cache_time (float-time))
-	    (cons 'newest_bug
-		  (caar
-		   (debbugs-soap-invoke
-		    debbugs-wsdl debbugs-port "newest_bugs" amount)))))
+       (list
+        (cons 'newest_bug
+		      (caar
+		       (debbugs-soap-invoke
+		        debbugs-wsdl debbugs-port "newest_bugs" amount)))))
 
 	  ;; Cache it.
-	  (when (or (null debbugs-cache-expiry) (natnump debbugs-cache-expiry))
-	    (puthash 0 status debbugs-cache-data)))
+      (debbugs-put-cache 0 status))
 
 	;; Return the value, as list.
 	(list (alist-get 'newest_bug status)))
@@ -477,15 +481,8 @@ Example:
 	  (delq nil
 	   (mapcar
 	    (lambda (bug)
-	      (let ((status (gethash bug debbugs-cache-data)))
-		(if (and
-		     status
-		     (or
-		      (null debbugs-cache-expiry)
-		      (and
-		       (natnump debbugs-cache-expiry)
-		       (> (alist-get 'cache_time status)
-			  (- (float-time) debbugs-cache-expiry)))))
+	      (let ((status (debbugs-get-cache bug)))
+		(if status
 		    (progn
 		      (setq cached-bugs (append cached-bugs (list status)))
 		      nil)
@@ -582,14 +579,9 @@ Example:
 	    (when (stringp (cdr y))
 	      (setcdr y (split-string (cdr y) ",\\| " t))))
 	  ;; Cache the result, and return.
-	  (if (or (null debbugs-cache-expiry) (natnump debbugs-cache-expiry))
-	      (puthash
-	       (alist-get 'key x)
-	       ;; Put also a time stamp.
-	       (cons (cons 'cache_time (float-time)) (alist-get 'value x))
-	       debbugs-cache-data)
-	    ;; Don't cache.
-	    (alist-get 'value x))))
+      (debbugs-put-cache
+       (alist-get 'key x)
+       (alist-get 'value x))))
       debbugs-soap-invoke-async-object))))
 
 (defun debbugs-get-usertag (&rest query)
diff --git a/test/debbugs-tests.el b/test/debbugs-tests.el
index ce6489ca39..d0aa9e87b4 100644
--- a/test/debbugs-tests.el
+++ b/test/debbugs-tests.el
@@ -28,6 +28,10 @@
 
 (require 'debbugs)
 
+;; TODO: This shouldn't be necessary but I get the error
+;; "(void-variable debbugs-gnu-use-threads)" without this
+(require 'debbugs-gnu)
+
 ;;; Helper Data:
 
 ;; Generated using this:
@@ -93,6 +97,20 @@
  :override (symbol-function #'soap-invoke-internal)
  #'debbugs-test--soap-invoke-internal)
 
+(defun debbugs-test--override-float-time (func &rest rest)
+  "Override `float-time' for FUNC with args REST."
+  (cl-letf (((symbol-function #'float-time)
+             (lambda (&optional _specified-time) 5000)))
+    (apply func rest)))
+
+(add-function
+ :around (symbol-function #'debbugs-get-cache)
+ #'debbugs-test--override-float-time)
+
+(add-function
+ :around (symbol-function #'debbugs-put-cache)
+ #'debbugs-test--override-float-time)
+
 ;;; Tests:
 
 (ert-deftest debbugs-test-get-bugs ()
@@ -115,16 +133,34 @@
     (should (string-equal debbugs-test--soap-operation-name "newest_bugs"))
     (should (equal debbugs-test--soap-parameters '(4)))))
 
+(ert-deftest debbugs-test-newest-bug-cached ()
+  "Test getting the newest bug from the cache."
+  (let (debbugs-test--soap-operation-name debbugs-test--soap-parameters)
+    ;; First time we get it from the server.
+    (should (equal (debbugs-newest-bugs 1) '(0)))
+    (should (equal debbugs-test--soap-operation-name "newest_bugs"))
+    (should (equal debbugs-test--soap-parameters '(1)))
+    (setq debbugs-test--soap-operation-name nil)
+    (setq debbugs-test--soap-parameters nil)
+    ;; Now it's cached
+    (should (equal (debbugs-newest-bugs 1) '(0)))
+    (should (equal debbugs-test--soap-operation-name nil))
+    (should (equal debbugs-test--soap-parameters nil))))
+
 (ert-deftest debbugs-test-get-status ()
   "Test \"get_status\"."
   (let (debbugs-test--soap-operation-name debbugs-test--soap-parameters)
-    (cl-letf (((symbol-function #'float-time)
-               (lambda (&optional _specified-time) 5000)))
-      (should (= (float-time) 5000))
-      (should (equal (sort (car (debbugs-get-status 64064)))
-                     (sort (car debbugs-test--bug-status))))
-      (should (string-equal debbugs-test--soap-operation-name "get_status"))
-      (should (equal debbugs-test--soap-parameters '([64064]))))))
+    (should (equal (sort (car (debbugs-get-status 64064)))
+                   (sort (car debbugs-test--bug-status))))
+    (should (string-equal debbugs-test--soap-operation-name "get_status"))
+    (should (equal debbugs-test--soap-parameters '([64064])))
+    (setq debbugs-test--soap-operation-name nil)
+    (setq debbugs-test--soap-parameters nil)
+    ;; cached
+    (should (equal (sort (car (debbugs-get-status 64064)))
+                   (sort (car debbugs-test--bug-status))))
+    (should (equal debbugs-test--soap-operation-name nil))
+    (should (equal debbugs-test--soap-parameters nil))))
 
 (ert-deftest debbugs-test-get-usertag ()
   "Test \"get_usertag\"."
-- 
2.47.1





Acknowledgement sent to Morgan Smith <Morgan.J.Smith@HIDDEN>:
New bug report received and forwarded. Copy sent to michael.albinus@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to michael.albinus@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#75789; 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, 15 Feb 2025 17:45:01 UTC

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