GNU bug report logs - #66509
29.1.50; let-alist should support numeric indexing

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: Spencer Baugh <sbaugh@HIDDEN>; Keywords: patch; dated Thu, 12 Oct 2023 22:04:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug No longer marked as fixed in versions 31.1 and reopened. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.

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


Received: (at 66509) by debbugs.gnu.org; 27 Sep 2024 07:17:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 27 03:17:14 2024
Received: from localhost ([127.0.0.1]:45404 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1su5E2-0003N7-J2
	for submit <at> debbugs.gnu.org; Fri, 27 Sep 2024 03:17:14 -0400
Received: from mail-ed1-f41.google.com ([209.85.208.41]:53258)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1su5E0-0003Ml-G6
 for 66509 <at> debbugs.gnu.org; Fri, 27 Sep 2024 03:17:13 -0400
Received: by mail-ed1-f41.google.com with SMTP id
 4fb4d7f45d1cf-5c26a52cf82so886553a12.2
 for <66509 <at> debbugs.gnu.org>; Fri, 27 Sep 2024 00:16:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727421338; x=1728026138; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=j34dOkECJcuxGiYTI/gzWoxg2q9kWN+51G+xMnqH/JA=;
 b=DW0lxgLcekb9zIKF4WykL5YGa7nznCeK3VkU8rybjClAsi5ItPb8YdHcSGHww8v10h
 68VaUcbaVhfxmcb/pCKQVADzUKsIxlMJ5sBWa1m/WlFwBJmUEezb/WFD3W/861usYIGI
 dBJP5ThpvDgo+r+QLGQyNsplZ8q7sC3A4M3D9tQKYwYBXAaRyY5Je07AmSR5y7ZSaO7N
 83xigFcKJ3QuVWbyjgt34SiHTuCxP6QpsZJMUfnQL8LudqMweMtTltgtonDISR5qJ/6w
 K8G6fZlobGqsNH/rBFgOMYVfLC+czyDrSsB5fW50e6zDCpaCs88Q7HD6JSA8czfNerpA
 oXkQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727421338; x=1728026138;
 h=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=j34dOkECJcuxGiYTI/gzWoxg2q9kWN+51G+xMnqH/JA=;
 b=aDwHVPAdhRqCezI1RPdbRO2ohQ1eVzX0h3nxnTPXS+nkzH1kV2SHkM/8isFfMXYHal
 kisilnhizyug30Z7FpMSNscz9LZQb33Oe6RSRRPPLQiKhmFpbrwgiu9C1tyNQk/QdfXL
 L/+1dmUGQM2oKIy8dCgj4x3F4zuwySp00TTuETRR08ksofgXBvO5v2s3N3WOCb4SyIUF
 0pW6K8qDMksOQOua6B9HBgxwyZ/KYzIdQ36GLFkF+6Syh/dVPLqT+XjRJ7ACjQwS4YJB
 ZOF3lltUAUVpVsftEd0z0ebvvG6/8HreE5paS0pqB9k+5gBvJfwd6rGDVmSGmYqYVaXc
 vANQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCWYlxnwgfy6lt83EJ6Cpvm5ebMtn/OA5ULJQiwDfZkGnXMZIcnFZToZ3Qo2Zz5CyH04MKmfiA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyhijEuWIMXwxGZcR9uGTqh2HLiKOfVFlqxBS8t6WXVUdlzxR1v
 0gf6N6qkgE4Vb4VDOgkWhAqk2/J6iZ1CPYJPZHIoeskceDPUatgF37uj5UUu2OrJrmFcl/Nyjq0
 fYzWXk2Xx4nqePvsmWSGW/tv5osc=
X-Google-Smtp-Source: AGHT+IHSvWyZY4vr1eZ5H4eo70Yue0pFU06RKUfdYeKV80mtHPg6fqsOQXVeckxcU3hmsvSO4NDmVZ8XoVPBB8B+ZSU=
X-Received: by 2002:a05:6402:42d2:b0:5c4:23a4:ad5f with SMTP id
 4fb4d7f45d1cf-5c8824cd086mr2291548a12.6.1727421338039; Fri, 27 Sep 2024
 00:15:38 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 27 Sep 2024 00:15:37 -0700
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <864j6c9oez.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 19 Sep
 2024 08:56:52 +0300")
References: <iera5sn5wid.fsf@HIDDEN> <ier7cnr5whb.fsf@HIDDEN>
 <CADwFkmnA477c-DAMjZD5Q4xYQ4aG=No1CBLPP53+pfeSBBYqfQ@HIDDEN>
 <CAAdUY-JAD73gRQFJXHbVh30H2FLpdvLBVNsNci5o+wGqeST+tQ@HIDDEN>
 <CADwFkmk3qVKv6nuT2q-+bJyXbfmLaMniyvmS6BDRM8Tn9cteFw@HIDDEN>
 <864j6c9oez.fsf@HIDDEN>
MIME-Version: 1.0
Date: Fri, 27 Sep 2024 00:15:37 -0700
Message-ID: <CADwFkmkuJXNGUJcUNis1KqEKSPC3=Nv3uyME2S20ehsKz_wE8Q@HIDDEN>
Subject: Re: bug#66509: 29.1.50; let-alist should support numeric indexing
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 66509
Cc: sbaugh@HIDDEN, 66509 <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 (-)

reopen 66509
thanks

>> Pushed to master (commit ae4171efdc6).
>>
>> I'm therefore closing this bug report.

I'm reopening this bug report, based on this request from Robert Pluim:

> Would it be possible to update the elisp manual as well (and maybe add
> an entry to NEWS)?

I think that should be done also, so I'm reopening the bug to track that
work.  Spencer, do you think you could you please address it?

Bonus points for adding tests, as requested by Eli.

Thanks in advance.




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

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


Received: (at 66509) by debbugs.gnu.org; 19 Sep 2024 05:57:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 01:57:22 2024
Received: from localhost ([127.0.0.1]:59651 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srAAL-0007st-Kh
	for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 01:57:21 -0400
Received: from eggs.gnu.org ([209.51.188.92]:52146)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1srAAK-0007sd-7O
 for 66509 <at> debbugs.gnu.org; Thu, 19 Sep 2024 01:57:20 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1srA9x-0007S4-F9; Thu, 19 Sep 2024 01:56:57 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=QYVNEdGO+ibrVdrRGfNe4V5G1ia+fQ8kZYy+Z7H098s=; b=Ule3xVT4lT7D
 0coXWhEe14Oufdz4DSL8rrzRLTjjCcZ0WE7RiQNmjZIPuQdOACdYnJYeH0wYDV/+KTbH0yKdVhVqc
 n0LT2u97sbHMeRWRlJHoIlw0/JRuFpzV9KnTJ4pccLW3cOUbjEbPCN0ycXugKcrGmPGpchFhPHGZ3
 086c5y/6uclxUYkqN+zlE7V5dOaa2INDchqNVUSHFtqewsx/u0Yahw25A2Ap/EKKzufgXuCFGTGEh
 FLdw7XnbybkovD3O/8J8XQW14x1jZLHweeNukLsnbZKjNvvsciU5OInh8ThOiw+0XTP/q02Stu9UZ
 O9Tw3ET5mGP6G1q4+TmiuA==;
Date: Thu, 19 Sep 2024 08:56:52 +0300
Message-Id: <864j6c9oez.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkmk3qVKv6nuT2q-+bJyXbfmLaMniyvmS6BDRM8Tn9cteFw@HIDDEN>
 (message from Stefan Kangas on Wed, 18 Sep 2024 18:56:37 -0700)
Subject: Re: bug#66509: 29.1.50; let-alist should support numeric indexing
References: <iera5sn5wid.fsf@HIDDEN> <ier7cnr5whb.fsf@HIDDEN>
 <CADwFkmnA477c-DAMjZD5Q4xYQ4aG=No1CBLPP53+pfeSBBYqfQ@HIDDEN>
 <CAAdUY-JAD73gRQFJXHbVh30H2FLpdvLBVNsNci5o+wGqeST+tQ@HIDDEN>
 <CADwFkmk3qVKv6nuT2q-+bJyXbfmLaMniyvmS6BDRM8Tn9cteFw@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 66509
Cc: sbaugh@HIDDEN, stefankangas@HIDDEN, 66509 <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: -3.3 (---)

> Resent-To: bug-gnu-emacs@HIDDEN
> Cc: Spencer Baugh <sbaugh@HIDDEN>, 66509-done <at> debbugs.gnu.org
> From: Stefan Kangas <stefankangas@HIDDEN>
> Date: Wed, 18 Sep 2024 18:56:37 -0700
> 
> Version: 31.1
> 
> Artur Malabarba <arturmalabarba@HIDDEN> writes:
> 
> > Hi all,
> >
> > The patch looks good.
> 
> Thanks.
> 
> > Stefan, would you mind applying it? (It'll take a while for me to get
> > everything configured.)
> 
> Pushed to master (commit ae4171efdc6).
> 
> I'm therefore closing this bug report.

Thanks, but could we perhaps have tests for this new functionality?




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

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


Received: (at 66509-done) by debbugs.gnu.org; 19 Sep 2024 01:58:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 18 21:58:04 2024
Received: from localhost ([127.0.0.1]:59478 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sr6Ql-00032J-WF
	for submit <at> debbugs.gnu.org; Wed, 18 Sep 2024 21:58:04 -0400
Received: from mail-ed1-f46.google.com ([209.85.208.46]:45371)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1sr6Qj-00031m-Mi
 for 66509-done <at> debbugs.gnu.org; Wed, 18 Sep 2024 21:58:02 -0400
Received: by mail-ed1-f46.google.com with SMTP id
 4fb4d7f45d1cf-5c26311c6f0so420761a12.3
 for <66509-done <at> debbugs.gnu.org>; Wed, 18 Sep 2024 18:57:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726710999; x=1727315799; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=AJRLn90+yytyYc0f/5Ml65WiMCS0kDS3UWLBbNCWcio=;
 b=lZX8NKplOsRrGHdktbxNNpo1pHRp0RyZ6PwFaOZqPWxMaLgPjOz867Q3yWmE7WUAQr
 CM6jleLgH1t80Souo+B1M7NCtEbjL/CRtX0BE1n8aD5tTQFvL7IkAG2OnkIiFeMwlvsq
 3cdNzOt+aGWY4G79mpK6GSf/FC9QFVw5ELobKlP4snibNrzREejdGdNivvdO50wqMlhW
 WEWQ87leeTjgEn9U7o34o8WdiIa/fx9HJiOtvyYKTY1lQliPU7NoMCCJ5edN5/DLXHNz
 L7lXD8kgD8oSM5rTc7KyeRySceX40cl1spRfYU+oPe+cAQAJclh6oeCtmf9lvgqIRX7O
 SbSA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726710999; x=1727315799;
 h=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=AJRLn90+yytyYc0f/5Ml65WiMCS0kDS3UWLBbNCWcio=;
 b=siPjxvnGvXzyDne2Xf3BwFomSHsp0ei7cu47VUnQLiOAMWDJtWLgzlGTEPUDm3VNNg
 gNyWJ/mD1yTHM+EklDLKa4QQAro724mXAzLjQWPIp12rtukHX2cSRTFlNfskKV5eGgjX
 FJfMKf6L4JQ3s9s+wO68S0iDNBqOl7i0CGpyzr6n+qLMqtSxA6d93FaGboTEFcf3Mh22
 ttScK5rpzg645svEXPXjjB0l+0ciy2KccQTtPUa499Hrjhvv7qlRmO1ZQJcpHTmNKK9P
 q5NlJuiDREcoD6BZAetWK1EDIgmTUKx7QqQ3FOLpIkhHcDfND+5w6/dcitEHP+TWlsAy
 yzEg==
X-Forwarded-Encrypted: i=1;
 AJvYcCUhQR+R72KeaCPdBwU5fEKco/zzvFwiD5ei+o9ZTOGx2H/nsr6dpF/r6IXIXjvO+b4x+A1gQvZKBovg <at> debbugs.gnu.org
X-Gm-Message-State: AOJu0YySmUeBd1v0s1kBj5Ik8qU1fgdr8dBwhBI3TBxBHshjLQHuykeV
 MUd0Re/8yzWUUHwaHrbq+ZOr41aE94OcxZWgsN7MaqQfE5lKeoxqElhp4Kf2mE8XE/L3KzHv7uq
 7dkuQF6maJcis6ktxl4er5erFTdw=
X-Google-Smtp-Source: AGHT+IHHddmImTyijy84Bq+CbnPeAt6zmykXkfE1AJEyHXhi/xJi2Tdm2QQJPleBy5gQdy8mc+bHGqD8cGdUVWtLBio=
X-Received: by 2002:a05:6402:5290:b0:5af:30d9:e2b6 with SMTP id
 4fb4d7f45d1cf-5c413e4a402mr23078443a12.23.1726710998335; Wed, 18 Sep 2024
 18:56:38 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Wed, 18 Sep 2024 18:56:37 -0700
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CAAdUY-JAD73gRQFJXHbVh30H2FLpdvLBVNsNci5o+wGqeST+tQ@HIDDEN>
References: <iera5sn5wid.fsf@HIDDEN> <ier7cnr5whb.fsf@HIDDEN>
 <CADwFkmnA477c-DAMjZD5Q4xYQ4aG=No1CBLPP53+pfeSBBYqfQ@HIDDEN>
 <CAAdUY-JAD73gRQFJXHbVh30H2FLpdvLBVNsNci5o+wGqeST+tQ@HIDDEN>
MIME-Version: 1.0
Date: Wed, 18 Sep 2024 18:56:37 -0700
Message-ID: <CADwFkmk3qVKv6nuT2q-+bJyXbfmLaMniyvmS6BDRM8Tn9cteFw@HIDDEN>
Subject: Re: bug#66509: 29.1.50; let-alist should support numeric indexing
To: Artur Malabarba <arturmalabarba@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 66509-done
Cc: Spencer Baugh <sbaugh@HIDDEN>, 66509-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

Artur Malabarba <arturmalabarba@HIDDEN> writes:

> Hi all,
>
> The patch looks good.

Thanks.

> Stefan, would you mind applying it? (It'll take a while for me to get
> everything configured.)

Pushed to master (commit ae4171efdc6).

I'm therefore closing this bug report.




Notification sent to Spencer Baugh <sbaugh@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 66509 <at> debbugs.gnu.org:


Received: (at 66509) by debbugs.gnu.org; 17 Sep 2024 02:09:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 16 22:09:08 2024
Received: from localhost ([127.0.0.1]:53695 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sqNeN-0008HL-Id
	for submit <at> debbugs.gnu.org; Mon, 16 Sep 2024 22:09:08 -0400
Received: from mail-pg1-f170.google.com ([209.85.215.170]:52418)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arturmalabarba@HIDDEN>) id 1sqNeL-0008Go-Ex
 for 66509 <at> debbugs.gnu.org; Mon, 16 Sep 2024 22:09:06 -0400
Received: by mail-pg1-f170.google.com with SMTP id
 41be03b00d2f7-7d4fbe62bf5so2283383a12.0
 for <66509 <at> debbugs.gnu.org>; Mon, 16 Sep 2024 19:08:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726538865; x=1727143665; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=2qnJ/rmHpIBW0cFd4LmPJYOopVlldz8Z7z5j4rCdE+s=;
 b=Ufnf8AmbbphIv3JYbZ2J0S4Y2dIvZ0VxLCf6xXYkE33Xqo694F1W4sHeSNAzqnNmMg
 x++kDzrH7lreum1Eq8CuIa3uPtV69jcA30EDXxrUblgfcK+/9fGVJG9GJxEdCwei47hJ
 XOw9XWd1xnyhIODHEZv6nY9yECI97rOZxfH57t78UPGpLcK/NVKR1nqOVQ4L/eyRLZe1
 DLBGTDhpBvX7EdGdR3/PTi/TXaCQvNHGFRQ0SKVN5i1kCfZCmA+NsBD7XTd3NG7tF4Ss
 rcaenDwddTWHFqw5m/YQz/Buug6fwhx465P9KmDx1c5C99on8nRnz0DYQ9H7SpuYad0a
 Ex1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726538865; x=1727143665;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=2qnJ/rmHpIBW0cFd4LmPJYOopVlldz8Z7z5j4rCdE+s=;
 b=HED/lt2DK67S/lo98QWJgIjsbByBu73EarP+UZTrd+OzcUIGhPaC2crqSwNCYa8s5D
 ZaGUsAvSusn2mAyJkkDDvEkl7ClJqkRgx9wr4pSedqVIn+IO6kro0ItL07u99avrmzK6
 kDBCkVKAe2Nrdn0rHXfjSx2V8mKVQIzMNCobikeXE58vk7b66v48rEdJ/495xJ84OJzD
 72nqwD2tO7gMoOEyx6VVJL/NsucxGjNem+RnXFF1AZlLZ4Wv5jDfzQsUVEP+GJRx7CZe
 4CkLgjbQP6WftRU/dNpeXSeau5oMgE7/h3TOSOZ2DFpVMT0rWGXhUdjVa5oHrsZJX+do
 U9ow==
X-Forwarded-Encrypted: i=1;
 AJvYcCXzrJKRka469Y/5VIOo76ptQIb+6uF+KWmyZEDASJNy3ZtmgK4QpNVdht7k4gw0hAmef9iIDQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwAJoZfRSlgcUEkD6RMACrCteyxCLgTg9pi3AzCftWv2iG2ttOT
 ySWph5HYvrESI4xzrUS8dxCYgo3EpwBmLqTThn25CL6IajhlBPgayWXFCzpn5XgPmAXjLfRSq70
 +XPd/vyctIxW5otysCjLnc80Mc2Q=
X-Google-Smtp-Source: AGHT+IFq282y5bA8EA3WqXxruWI/pXxXknKjY/NPe3kJtYS5bo8UsUcRiR0g7Fo5Yj9lB3d8V+43n6reFayYt9x11U4=
X-Received: by 2002:a05:6300:6681:b0:1cf:52fe:38ff with SMTP id
 adf61e73a8af0-1d112b360fbmr19650506637.8.1726538865192; Mon, 16 Sep 2024
 19:07:45 -0700 (PDT)
MIME-Version: 1.0
References: <iera5sn5wid.fsf@HIDDEN> <ier7cnr5whb.fsf@HIDDEN>
 <CADwFkmnA477c-DAMjZD5Q4xYQ4aG=No1CBLPP53+pfeSBBYqfQ@HIDDEN>
In-Reply-To: <CADwFkmnA477c-DAMjZD5Q4xYQ4aG=No1CBLPP53+pfeSBBYqfQ@HIDDEN>
From: Artur Malabarba <arturmalabarba@HIDDEN>
Date: Mon, 16 Sep 2024 23:07:33 -0300
Message-ID: <CAAdUY-JAD73gRQFJXHbVh30H2FLpdvLBVNsNci5o+wGqeST+tQ@HIDDEN>
Subject: Re: bug#66509: 29.1.50; let-alist should support numeric indexing
To: Stefan Kangas <stefankangas@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000c0399b06224727f8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 66509
Cc: Spencer Baugh <sbaugh@HIDDEN>, 66509 <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 (-)

--000000000000c0399b06224727f8
Content-Type: text/plain; charset="UTF-8"

Hi all,

The patch looks good.
Stefan, would you mind applying it? (It'll take a while for me to get
everything configured.)

best,
Artur


On Tue, 10 Sept 2024 at 20:22, Stefan Kangas <stefankangas@HIDDEN> wrote:

> Artur, do you have any thoughts on the below patch?
>
> Spencer Baugh <sbaugh@HIDDEN> writes:
>
> > From 28e52a343f72dddd991cafd23fea910cc5f64ac5 Mon Sep 17 00:00:00 2001
> > From: Spencer Baugh <sbaugh@HIDDEN>
> > Date: Thu, 12 Oct 2023 18:01:46 -0400
> > Subject: [PATCH] Support numeric indexing in let-alist
> >
> > let-alist is very useful.  But sometimes an alist contains a list in
> > the middle, which contains yet more alists.  Previously, this was
> > somewhat painful to deal with, and required something like:
> >
> > (let-alist alist
> >   (let-alist (nth 0 .a)
> >     (let-alist (nth 3 .b)
> >        .c)))
> >
> > Now, the following works:
> >
> > (let-alist alist
> >   .a.0.b.3.c)
> >
> > * lisp/emacs-lisp/let-alist.el (let-alist--access-sexp): Properly
> > parse numbers.
> > (let-alist--list-to-sexp): Use nth to handle numbers.
> > (let-alist): Update docs.
> > ---
> >  lisp/emacs-lisp/let-alist.el | 25 +++++++++++++++----------
> >  1 file changed, 15 insertions(+), 10 deletions(-)
> >
> > diff --git a/lisp/emacs-lisp/let-alist.el b/lisp/emacs-lisp/let-alist.el
> > index d9ad46b2af7..de7c087bf2a 100644
> > --- a/lisp/emacs-lisp/let-alist.el
> > +++ b/lisp/emacs-lisp/let-alist.el
> > @@ -36,22 +36,23 @@
> >  ;; symbol inside body is let-bound to their cdrs in the alist.  Dotted
> >  ;; symbol is any symbol starting with a `.'.  Only those present in
> >  ;; the body are let-bound and this search is done at compile time.
> > +;; A number will result in a list index.
> >  ;;
> >  ;; For instance, the following code
> >  ;;
> >  ;;   (let-alist alist
> > -;;     (if (and .title .body)
> > +;;     (if (and .title.0 .body)
> >  ;;         .body
> >  ;;       .site
> >  ;;       .site.contents))
> >  ;;
> >  ;; essentially expands to
> >  ;;
> > -;;   (let ((.title (cdr (assq 'title alist)))
> > +;;   (let ((.title.0 (nth 0 (cdr (assq 'title alist))))
> >  ;;         (.body  (cdr (assq 'body alist)))
> >  ;;         (.site  (cdr (assq 'site alist)))
> >  ;;         (.site.contents (cdr (assq 'contents (cdr (assq 'site
> alist))))))
> > -;;     (if (and .title .body)
> > +;;     (if (and .title.0 .body)
> >  ;;         .body
> >  ;;       .site
> >  ;;       .site.contents))
> > @@ -93,14 +94,17 @@ let-alist--access-sexp
> >      (if (string-match "\\`\\." name)
> >          clean
> >        (let-alist--list-to-sexp
> > -       (mapcar #'intern (nreverse (split-string name "\\.")))
> > +       (mapcar #'read (nreverse (split-string name "\\.")))
> >         variable))))
> >
> >  (defun let-alist--list-to-sexp (list var)
> >    "Turn symbols LIST into recursive calls to `cdr' `assq' on VAR."
> > -  `(cdr (assq ',(car list)
> > -              ,(if (cdr list) (let-alist--list-to-sexp (cdr list) var)
> > -                 var))))
> > +  (let ((sym (car list))
> > +        (rest (if (cdr list) (let-alist--list-to-sexp (cdr list) var)
> > +                 var)))
> > +    (cond
> > +     ((numberp sym) `(nth ,sym ,rest))
> > +     (t `(cdr (assq ',sym ,rest))))))
> >
> >  (defun let-alist--remove-dot (symbol)
> >    "Return SYMBOL, sans an initial dot."
> > @@ -116,22 +120,23 @@ let-alist
> >    "Let-bind dotted symbols to their cdrs in ALIST and execute BODY.
> >  Dotted symbol is any symbol starting with a `.'.  Only those present
> >  in BODY are let-bound and this search is done at compile time.
> > +A number will result in a list index.
> >
> >  For instance, the following code
> >
> >    (let-alist alist
> > -    (if (and .title .body)
> > +    (if (and .title.0 .body)
> >          .body
> >        .site
> >        .site.contents))
> >
> >  essentially expands to
> >
> > -  (let ((.title (cdr (assq \\='title alist)))
> > +  (let ((.title (nth 0 (cdr (assq \\='title alist))))
> >          (.body  (cdr (assq \\='body alist)))
> >          (.site  (cdr (assq \\='site alist)))
> >          (.site.contents (cdr (assq \\='contents (cdr (assq \\='site
> alist))))))
> > -    (if (and .title .body)
> > +    (if (and .title.0 .body)
> >          .body
> >        .site
> >        .site.contents))
>

--000000000000c0399b06224727f8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi all,<div><br></div><div>The patch looks good.<br>Stefan=
, would you mind applying it? (It&#39;ll take a while for me to get everyth=
ing configured.)</div><div><br></div><div>best,<br clear=3D"all"><div><div =
dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail_signature">Ar=
tur</div></div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"l=
tr" class=3D"gmail_attr">On Tue, 10 Sept 2024 at 20:22, Stefan Kangas &lt;<=
a href=3D"mailto:stefankangas@HIDDEN">stefankangas@HIDDEN</a>&gt; wro=
te:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Artur, do yo=
u have any thoughts on the below patch?<br>
<br>
Spencer Baugh &lt;<a href=3D"mailto:sbaugh@HIDDEN" target=3D"_blank=
">sbaugh@HIDDEN</a>&gt; writes:<br>
<br>
&gt; From 28e52a343f72dddd991cafd23fea910cc5f64ac5 Mon Sep 17 00:00:00 2001=
<br>
&gt; From: Spencer Baugh &lt;<a href=3D"mailto:sbaugh@HIDDEN" targe=
t=3D"_blank">sbaugh@HIDDEN</a>&gt;<br>
&gt; Date: Thu, 12 Oct 2023 18:01:46 -0400<br>
&gt; Subject: [PATCH] Support numeric indexing in let-alist<br>
&gt;<br>
&gt; let-alist is very useful.=C2=A0 But sometimes an alist contains a list=
 in<br>
&gt; the middle, which contains yet more alists.=C2=A0 Previously, this was=
<br>
&gt; somewhat painful to deal with, and required something like:<br>
&gt;<br>
&gt; (let-alist alist<br>
&gt;=C2=A0 =C2=A0(let-alist (nth 0 .a)<br>
&gt;=C2=A0 =C2=A0 =C2=A0(let-alist (nth 3 .b)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 .c)))<br>
&gt;<br>
&gt; Now, the following works:<br>
&gt;<br>
&gt; (let-alist alist<br>
&gt;=C2=A0 =C2=A0.a.0.b.3.c)<br>
&gt;<br>
&gt; * lisp/emacs-lisp/let-alist.el (let-alist--access-sexp): Properly<br>
&gt; parse numbers.<br>
&gt; (let-alist--list-to-sexp): Use nth to handle numbers.<br>
&gt; (let-alist): Update docs.<br>
&gt; ---<br>
&gt;=C2=A0 lisp/emacs-lisp/let-alist.el | 25 +++++++++++++++----------<br>
&gt;=C2=A0 1 file changed, 15 insertions(+), 10 deletions(-)<br>
&gt;<br>
&gt; diff --git a/lisp/emacs-lisp/let-alist.el b/lisp/emacs-lisp/let-alist.=
el<br>
&gt; index d9ad46b2af7..de7c087bf2a 100644<br>
&gt; --- a/lisp/emacs-lisp/let-alist.el<br>
&gt; +++ b/lisp/emacs-lisp/let-alist.el<br>
&gt; @@ -36,22 +36,23 @@<br>
&gt;=C2=A0 ;; symbol inside body is let-bound to their cdrs in the alist.=
=C2=A0 Dotted<br>
&gt;=C2=A0 ;; symbol is any symbol starting with a `.&#39;.=C2=A0 Only thos=
e present in<br>
&gt;=C2=A0 ;; the body are let-bound and this search is done at compile tim=
e.<br>
&gt; +;; A number will result in a list index.<br>
&gt;=C2=A0 ;;<br>
&gt;=C2=A0 ;; For instance, the following code<br>
&gt;=C2=A0 ;;<br>
&gt;=C2=A0 ;;=C2=A0 =C2=A0(let-alist alist<br>
&gt; -;;=C2=A0 =C2=A0 =C2=A0(if (and .title .body)<br>
&gt; +;;=C2=A0 =C2=A0 =C2=A0(if (and .title.0 .body)<br>
&gt;=C2=A0 ;;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.body<br>
&gt;=C2=A0 ;;=C2=A0 =C2=A0 =C2=A0 =C2=A0.site<br>
&gt;=C2=A0 ;;=C2=A0 =C2=A0 =C2=A0 =C2=A0.site.contents))<br>
&gt;=C2=A0 ;;<br>
&gt;=C2=A0 ;; essentially expands to<br>
&gt;=C2=A0 ;;<br>
&gt; -;;=C2=A0 =C2=A0(let ((.title (cdr (assq &#39;title alist)))<br>
&gt; +;;=C2=A0 =C2=A0(let ((.title.0 (nth 0 (cdr (assq &#39;title alist))))=
<br>
&gt;=C2=A0 ;;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(.body=C2=A0 (cdr (assq &#39=
;body alist)))<br>
&gt;=C2=A0 ;;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(.site=C2=A0 (cdr (assq &#39=
;site alist)))<br>
&gt;=C2=A0 ;;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(.site.contents (cdr (assq &=
#39;contents (cdr (assq &#39;site alist))))))<br>
&gt; -;;=C2=A0 =C2=A0 =C2=A0(if (and .title .body)<br>
&gt; +;;=C2=A0 =C2=A0 =C2=A0(if (and .title.0 .body)<br>
&gt;=C2=A0 ;;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.body<br>
&gt;=C2=A0 ;;=C2=A0 =C2=A0 =C2=A0 =C2=A0.site<br>
&gt;=C2=A0 ;;=C2=A0 =C2=A0 =C2=A0 =C2=A0.site.contents))<br>
&gt; @@ -93,14 +94,17 @@ let-alist--access-sexp<br>
&gt;=C2=A0 =C2=A0 =C2=A0 (if (string-match &quot;\\`\\.&quot; name)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 clean<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let-alist--list-to-sexp<br>
&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0(mapcar #&#39;intern (nreverse (split-stri=
ng name &quot;\\.&quot;)))<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0(mapcar #&#39;read (nreverse (split-string=
 name &quot;\\.&quot;)))<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0variable))))<br>
&gt;<br>
&gt;=C2=A0 (defun let-alist--list-to-sexp (list var)<br>
&gt;=C2=A0 =C2=A0 &quot;Turn symbols LIST into recursive calls to `cdr&#39;=
 `assq&#39; on VAR.&quot;<br>
&gt; -=C2=A0 `(cdr (assq &#39;,(car list)<br>
&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ,(if (cdr list) (let=
-alist--list-to-sexp (cdr list) var)<br>
&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0var))))=
<br>
&gt; +=C2=A0 (let ((sym (car list))<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (rest (if (cdr list) (let-alist--list-to-=
sexp (cdr list) var)<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0var)))<=
br>
&gt; +=C2=A0 =C2=A0 (cond<br>
&gt; +=C2=A0 =C2=A0 =C2=A0((numberp sym) `(nth ,sym ,rest))<br>
&gt; +=C2=A0 =C2=A0 =C2=A0(t `(cdr (assq &#39;,sym ,rest))))))<br>
&gt;<br>
&gt;=C2=A0 (defun let-alist--remove-dot (symbol)<br>
&gt;=C2=A0 =C2=A0 &quot;Return SYMBOL, sans an initial dot.&quot;<br>
&gt; @@ -116,22 +120,23 @@ let-alist<br>
&gt;=C2=A0 =C2=A0 &quot;Let-bind dotted symbols to their cdrs in ALIST and =
execute BODY.<br>
&gt;=C2=A0 Dotted symbol is any symbol starting with a `.&#39;.=C2=A0 Only =
those present<br>
&gt;=C2=A0 in BODY are let-bound and this search is done at compile time.<b=
r>
&gt; +A number will result in a list index.<br>
&gt;<br>
&gt;=C2=A0 For instance, the following code<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 (let-alist alist<br>
&gt; -=C2=A0 =C2=A0 (if (and .title .body)<br>
&gt; +=C2=A0 =C2=A0 (if (and .title.0 .body)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .body<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 .site<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 .site.contents))<br>
&gt;<br>
&gt;=C2=A0 essentially expands to<br>
&gt;<br>
&gt; -=C2=A0 (let ((.title (cdr (assq \\=3D&#39;title alist)))<br>
&gt; +=C2=A0 (let ((.title (nth 0 (cdr (assq \\=3D&#39;title alist))))<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (.body=C2=A0 (cdr (assq \\=3D&#39;bo=
dy alist)))<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (.site=C2=A0 (cdr (assq \\=3D&#39;si=
te alist)))<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (.site.contents (cdr (assq \\=3D&#39=
;contents (cdr (assq \\=3D&#39;site alist))))))<br>
&gt; -=C2=A0 =C2=A0 (if (and .title .body)<br>
&gt; +=C2=A0 =C2=A0 (if (and .title.0 .body)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .body<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 .site<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 .site.contents))<br>
</blockquote></div>

--000000000000c0399b06224727f8--




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

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


Received: (at 66509) by debbugs.gnu.org; 10 Sep 2024 23:23:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 10 19:23:31 2024
Received: from localhost ([127.0.0.1]:37152 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1soACo-00012E-J3
	for submit <at> debbugs.gnu.org; Tue, 10 Sep 2024 19:23:30 -0400
Received: from mail-ed1-f54.google.com ([209.85.208.54]:55596)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1soACl-00011z-Q9
 for 66509 <at> debbugs.gnu.org; Tue, 10 Sep 2024 19:23:28 -0400
Received: by mail-ed1-f54.google.com with SMTP id
 4fb4d7f45d1cf-5bf01bdaff0so6870555a12.3
 for <66509 <at> debbugs.gnu.org>; Tue, 10 Sep 2024 16:23:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726010536; x=1726615336; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=MYQOXV/ISne2HdmNJ+XvVo0wn0Vmf01l21XJr6NCGKg=;
 b=cseHIY7lhgY+ueJJ+FiPDTMFv4k6KUWGLheAG8xNwqyPikq+m4SSo902NDeRnTHtP7
 IEaOQ6rkGHUs0cH6MdFPELqaHsscrwxblOFy6/txpP7w0ncyhUKva5KXA+xlCvVjuQc6
 v31UzxY0rLSkQC4OtQwKXMsnHtVsi/LzwJLmoYLQeTu2hkiLVYgsDqoAshUPHlAvYhxs
 1qG3CD9w+DKX2Oqm907IRUVWnwzz1CdIzdiY2XnOhVVwLVDDThRCkL1YPUFykU5ear24
 KAkYnXkw/IkTQT8mltgtwuZDbQHPcx5c74TGhKHBo6QEzB409dMZTM95RVWTpciTr4Z9
 o1zA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726010536; x=1726615336;
 h=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=MYQOXV/ISne2HdmNJ+XvVo0wn0Vmf01l21XJr6NCGKg=;
 b=JceQ5qfcNNEhN/8vK9/bCl+Em2sS3RsshiAfO5dVofZplqHSQbiUFL6XqEJrEFFrdB
 742FDpjSluv2usjDcPr/COWLu0tkBCHF+WDAdtlUItfM5mpAlWqijd0lN21gRNzEo+3p
 SV7WbxskRVA+X1sRYYD1MOrVOBnL9pB0CBN4sLjX8hpX/7tpSzbjbRacN25eBH5SydmA
 hco78tXE9wO5W0VxyX59rhZbV+GNTh5oUgzT4hH5dlrwyjwDV7qe0ZgL/bxexncvOFYF
 XfaqP/1vMO5b9WNqpl0bA5a9ckkdAkKnk2t4sAa910st1aw/gwYP2X+C9KKpvAf+fMYt
 /r1w==
X-Gm-Message-State: AOJu0YxjlN3roXSD5TI42wHsqe2oZmd+8zY0MvlpfBrMVIvUT05NLRI+
 ylWSdJST5j1UIsoW+jqkX2i8PSqRSvl9adJLTyz8OUUmQJ1ODXp4AVhsIjGlSG3WCeA1JMoimCG
 7Eap3E4KzDCp+jv2WysYQM1k2nHo=
X-Google-Smtp-Source: AGHT+IGy/mAPonwoL/cl5nIW5LF6nctr37QMsiPaC7LABj9RJTHW89NXQ9EmvZT0fnI5E38ZTzcTyTa6NcYQUdr4rJA=
X-Received: by 2002:a05:6402:13d5:b0:5c2:4dcc:b911 with SMTP id
 4fb4d7f45d1cf-5c3eac20d9emr9404865a12.26.1726010536432; Tue, 10 Sep 2024
 16:22:16 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Tue, 10 Sep 2024 19:22:16 -0400
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <ier7cnr5whb.fsf@HIDDEN> (Spencer Baugh's message of
 "Thu, 12 Oct 2023 18:04:00 -0400")
References: <iera5sn5wid.fsf@HIDDEN> <ier7cnr5whb.fsf@HIDDEN>
MIME-Version: 1.0
Date: Tue, 10 Sep 2024 19:22:16 -0400
Message-ID: <CADwFkmnA477c-DAMjZD5Q4xYQ4aG=No1CBLPP53+pfeSBBYqfQ@HIDDEN>
Subject: Re: bug#66509: 29.1.50; let-alist should support numeric indexing
To: Spencer Baugh <sbaugh@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 66509
Cc: Artur Malabarba <arturmalabarba@HIDDEN>, 66509 <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 (-)

Artur, do you have any thoughts on the below patch?

Spencer Baugh <sbaugh@HIDDEN> writes:

> From 28e52a343f72dddd991cafd23fea910cc5f64ac5 Mon Sep 17 00:00:00 2001
> From: Spencer Baugh <sbaugh@HIDDEN>
> Date: Thu, 12 Oct 2023 18:01:46 -0400
> Subject: [PATCH] Support numeric indexing in let-alist
>
> let-alist is very useful.  But sometimes an alist contains a list in
> the middle, which contains yet more alists.  Previously, this was
> somewhat painful to deal with, and required something like:
>
> (let-alist alist
>   (let-alist (nth 0 .a)
>     (let-alist (nth 3 .b)
>        .c)))
>
> Now, the following works:
>
> (let-alist alist
>   .a.0.b.3.c)
>
> * lisp/emacs-lisp/let-alist.el (let-alist--access-sexp): Properly
> parse numbers.
> (let-alist--list-to-sexp): Use nth to handle numbers.
> (let-alist): Update docs.
> ---
>  lisp/emacs-lisp/let-alist.el | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/lisp/emacs-lisp/let-alist.el b/lisp/emacs-lisp/let-alist.el
> index d9ad46b2af7..de7c087bf2a 100644
> --- a/lisp/emacs-lisp/let-alist.el
> +++ b/lisp/emacs-lisp/let-alist.el
> @@ -36,22 +36,23 @@
>  ;; symbol inside body is let-bound to their cdrs in the alist.  Dotted
>  ;; symbol is any symbol starting with a `.'.  Only those present in
>  ;; the body are let-bound and this search is done at compile time.
> +;; A number will result in a list index.
>  ;;
>  ;; For instance, the following code
>  ;;
>  ;;   (let-alist alist
> -;;     (if (and .title .body)
> +;;     (if (and .title.0 .body)
>  ;;         .body
>  ;;       .site
>  ;;       .site.contents))
>  ;;
>  ;; essentially expands to
>  ;;
> -;;   (let ((.title (cdr (assq 'title alist)))
> +;;   (let ((.title.0 (nth 0 (cdr (assq 'title alist))))
>  ;;         (.body  (cdr (assq 'body alist)))
>  ;;         (.site  (cdr (assq 'site alist)))
>  ;;         (.site.contents (cdr (assq 'contents (cdr (assq 'site alist))))))
> -;;     (if (and .title .body)
> +;;     (if (and .title.0 .body)
>  ;;         .body
>  ;;       .site
>  ;;       .site.contents))
> @@ -93,14 +94,17 @@ let-alist--access-sexp
>      (if (string-match "\\`\\." name)
>          clean
>        (let-alist--list-to-sexp
> -       (mapcar #'intern (nreverse (split-string name "\\.")))
> +       (mapcar #'read (nreverse (split-string name "\\.")))
>         variable))))
>
>  (defun let-alist--list-to-sexp (list var)
>    "Turn symbols LIST into recursive calls to `cdr' `assq' on VAR."
> -  `(cdr (assq ',(car list)
> -              ,(if (cdr list) (let-alist--list-to-sexp (cdr list) var)
> -                 var))))
> +  (let ((sym (car list))
> +        (rest (if (cdr list) (let-alist--list-to-sexp (cdr list) var)
> +                 var)))
> +    (cond
> +     ((numberp sym) `(nth ,sym ,rest))
> +     (t `(cdr (assq ',sym ,rest))))))
>
>  (defun let-alist--remove-dot (symbol)
>    "Return SYMBOL, sans an initial dot."
> @@ -116,22 +120,23 @@ let-alist
>    "Let-bind dotted symbols to their cdrs in ALIST and execute BODY.
>  Dotted symbol is any symbol starting with a `.'.  Only those present
>  in BODY are let-bound and this search is done at compile time.
> +A number will result in a list index.
>
>  For instance, the following code
>
>    (let-alist alist
> -    (if (and .title .body)
> +    (if (and .title.0 .body)
>          .body
>        .site
>        .site.contents))
>
>  essentially expands to
>
> -  (let ((.title (cdr (assq \\='title alist)))
> +  (let ((.title (nth 0 (cdr (assq \\='title alist))))
>          (.body  (cdr (assq \\='body alist)))
>          (.site  (cdr (assq \\='site alist)))
>          (.site.contents (cdr (assq \\='contents (cdr (assq \\='site alist))))))
> -    (if (and .title .body)
> +    (if (and .title.0 .body)
>          .body
>        .site
>        .site.contents))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#66509; Package emacs. Full text available.
Added tag(s) patch. Request was from Spencer Baugh <sbaugh@HIDDEN> to control <at> debbugs.gnu.org. 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 66509 <at> debbugs.gnu.org:


Received: (at 66509) by debbugs.gnu.org; 12 Oct 2023 22:04:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 12 18:04:31 2023
Received: from localhost ([127.0.0.1]:44408 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qr3nD-0007Cu-7d
	for submit <at> debbugs.gnu.org; Thu, 12 Oct 2023 18:04:31 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18]:60919)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qr3nA-0007Ca-AT
 for 66509 <at> debbugs.gnu.org; Thu, 12 Oct 2023 18:04:30 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: 66509 <at> debbugs.gnu.org
Subject: Re: bug#66509: 29.1.50; let-alist should support numeric indexing
In-Reply-To: <iera5sn5wid.fsf@HIDDEN> (Spencer Baugh's message of
 "Thu, 12 Oct 2023 18:03:22 -0400")
References: <iera5sn5wid.fsf@HIDDEN>
Date: Thu, 12 Oct 2023 18:04:00 -0400
Message-ID: <ier7cnr5whb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-Support-numeric-indexing-in-let-alist.patch
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 66509
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 (-)

From 28e52a343f72dddd991cafd23fea910cc5f64ac5 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Thu, 12 Oct 2023 18:01:46 -0400
Subject: [PATCH] Support numeric indexing in let-alist

let-alist is very useful.  But sometimes an alist contains a list in
the middle, which contains yet more alists.  Previously, this was
somewhat painful to deal with, and required something like:

(let-alist alist
  (let-alist (nth 0 .a)
    (let-alist (nth 3 .b)
       .c)))

Now, the following works:

(let-alist alist
  .a.0.b.3.c)

* lisp/emacs-lisp/let-alist.el (let-alist--access-sexp): Properly
parse numbers.
(let-alist--list-to-sexp): Use nth to handle numbers.
(let-alist): Update docs.
---
 lisp/emacs-lisp/let-alist.el | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/lisp/emacs-lisp/let-alist.el b/lisp/emacs-lisp/let-alist.el
index d9ad46b2af7..de7c087bf2a 100644
--- a/lisp/emacs-lisp/let-alist.el
+++ b/lisp/emacs-lisp/let-alist.el
@@ -36,22 +36,23 @@
 ;; symbol inside body is let-bound to their cdrs in the alist.  Dotted
 ;; symbol is any symbol starting with a `.'.  Only those present in
 ;; the body are let-bound and this search is done at compile time.
+;; A number will result in a list index.
 ;;
 ;; For instance, the following code
 ;;
 ;;   (let-alist alist
-;;     (if (and .title .body)
+;;     (if (and .title.0 .body)
 ;;         .body
 ;;       .site
 ;;       .site.contents))
 ;;
 ;; essentially expands to
 ;;
-;;   (let ((.title (cdr (assq 'title alist)))
+;;   (let ((.title.0 (nth 0 (cdr (assq 'title alist))))
 ;;         (.body  (cdr (assq 'body alist)))
 ;;         (.site  (cdr (assq 'site alist)))
 ;;         (.site.contents (cdr (assq 'contents (cdr (assq 'site alist))))))
-;;     (if (and .title .body)
+;;     (if (and .title.0 .body)
 ;;         .body
 ;;       .site
 ;;       .site.contents))
@@ -93,14 +94,17 @@ let-alist--access-sexp
     (if (string-match "\\`\\." name)
         clean
       (let-alist--list-to-sexp
-       (mapcar #'intern (nreverse (split-string name "\\.")))
+       (mapcar #'read (nreverse (split-string name "\\.")))
        variable))))
 
 (defun let-alist--list-to-sexp (list var)
   "Turn symbols LIST into recursive calls to `cdr' `assq' on VAR."
-  `(cdr (assq ',(car list)
-              ,(if (cdr list) (let-alist--list-to-sexp (cdr list) var)
-                 var))))
+  (let ((sym (car list))
+        (rest (if (cdr list) (let-alist--list-to-sexp (cdr list) var)
+                 var)))
+    (cond
+     ((numberp sym) `(nth ,sym ,rest))
+     (t `(cdr (assq ',sym ,rest))))))
 
 (defun let-alist--remove-dot (symbol)
   "Return SYMBOL, sans an initial dot."
@@ -116,22 +120,23 @@ let-alist
   "Let-bind dotted symbols to their cdrs in ALIST and execute BODY.
 Dotted symbol is any symbol starting with a `.'.  Only those present
 in BODY are let-bound and this search is done at compile time.
+A number will result in a list index.
 
 For instance, the following code
 
   (let-alist alist
-    (if (and .title .body)
+    (if (and .title.0 .body)
         .body
       .site
       .site.contents))
 
 essentially expands to
 
-  (let ((.title (cdr (assq \\='title alist)))
+  (let ((.title (nth 0 (cdr (assq \\='title alist))))
         (.body  (cdr (assq \\='body alist)))
         (.site  (cdr (assq \\='site alist)))
         (.site.contents (cdr (assq \\='contents (cdr (assq \\='site alist))))))
-    (if (and .title .body)
+    (if (and .title.0 .body)
         .body
       .site
       .site.contents))
-- 
2.39.3





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

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


Received: (at submit) by debbugs.gnu.org; 12 Oct 2023 22:03:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 12 18:03:59 2023
Received: from localhost ([127.0.0.1]:44403 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qr3mg-0007BD-Mf
	for submit <at> debbugs.gnu.org; Thu, 12 Oct 2023 18:03:59 -0400
Received: from lists.gnu.org ([2001:470:142::17]:34572)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sbaugh@HIDDEN>) id 1qr3mb-0007Ax-AF
 for submit <at> debbugs.gnu.org; Thu, 12 Oct 2023 18:03:57 -0400
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 <sbaugh@HIDDEN>)
 id 1qr3m9-0002jP-5e
 for bug-gnu-emacs@HIDDEN; Thu, 12 Oct 2023 18:03:25 -0400
Received: from mxout5.mail.janestreet.com ([64.215.233.18])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>)
 id 1qr3m7-0002SH-Nn
 for bug-gnu-emacs@HIDDEN; Thu, 12 Oct 2023 18:03:24 -0400
From: Spencer Baugh <sbaugh@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.1.50; let-alist should support numeric indexing
Date: Thu, 12 Oct 2023 18:03:22 -0400
Message-ID: <iera5sn5wid.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@HIDDEN;
 helo=mxout5.mail.janestreet.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H5=0.001,
 RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
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 (/)


It would be nice if let-alist supported indexing.  So if my alist
contained lists in some places, instead of writing:

(let-alist alist
  (let-alist (nth 0 .a)
    (let-alist (nth 3 .b)
       .c)))

I could instead write:

(let-alist alist
  .a.0.b.3.c)

A patch which does this to follow.




Acknowledgement sent to Spencer Baugh <sbaugh@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#66509; 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: Sun, 12 Jan 2025 05:45:02 UTC

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