From unknown Thu Sep 11 02:37:37 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#79330 <79330@debbugs.gnu.org> To: bug#79330 <79330@debbugs.gnu.org> Subject: Status: misleading ring-convert-sequence-to-ring Reply-To: bug#79330 <79330@debbugs.gnu.org> Date: Thu, 11 Sep 2025 09:37:37 +0000 retitle 79330 misleading ring-convert-sequence-to-ring reassign 79330 emacs submitter 79330 Liu Hui severity 79330 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 28 06:47:21 2025 Received: (at submit) by debbugs.gnu.org; 28 Aug 2025 10:47:21 +0000 Received: from localhost ([127.0.0.1]:38454 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uraA4-0003Dx-Tl for submit@debbugs.gnu.org; Thu, 28 Aug 2025 06:47:21 -0400 Received: from lists.gnu.org ([2001:470:142::17]:53978) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uraA2-0003Cj-Hm for submit@debbugs.gnu.org; Thu, 28 Aug 2025 06:47:19 -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 ) id 1ura9v-0004Ul-Cs for bug-gnu-emacs@gnu.org; Thu, 28 Aug 2025 06:47:11 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ura9t-00048d-St for bug-gnu-emacs@gnu.org; Thu, 28 Aug 2025 06:47:11 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3ceb830dd58so39607f8f.0 for ; Thu, 28 Aug 2025 03:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756378028; x=1756982828; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=m7ZsywTeICoZfGMeYrowKAK6FbRE1D9elspFAFX1iUk=; b=MncIMd592ZAU+4GjjbRRs8hcCIcIbttx80Kcfd3EcKVPBGqzJlguP4fCIzCIn6QCYn EOr+M47vAoGc4Qr0hxs/35+YUk/hZwQD3NfOlQyZxJmWCxeVtOno6jUCdU/m2dp+jGKX LlZoWzvW/9WpNC6UazstMmf7YavC19nG/oQ693uz9Y9BUnXroq5jEYiKiM1lu1+agDhl ve0G7G+RCujzjK+iqer90KaPBBjINWPlLAqJAZMuBYa+TNcBM6kDdq6pFSVxzDtqbF8s rMnUuGF1sbPTgFCNYUUgN0ooLI6gAh/2k1Csci+jMUyk/CcxtNUu2KyThnwjHAVPLnAv wS5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756378028; x=1756982828; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=m7ZsywTeICoZfGMeYrowKAK6FbRE1D9elspFAFX1iUk=; b=C2m6ujDvmcyBpjk3lStCfQqnexjoTr4DZXIfr5o6MA1/PVj6imT3bWq+Ha41e/5fg8 myKooO72KpTZAXnSHDn+vxuRqKDGWjim+ujMQDqojQWU/m9eOUi1Qurht4ksdaUxwVBu rFxQT4/66CVvo4z742syhUPkTDOZmz6Po589lAUTDheX1gX7A4hHnn1pvwm4y8/I4Ikq i4UOSckZnu6hK2L+NipW7GtaYbexj1D4irsk1Kbml3vgny2pqT/FEXOO3Ziws4UDtouR 5cWxzULr4y7/Ga0OZ+MQxWxfQiaG8U/JhrXpuWDzruQFuSkx+U/5kSRm3X1G9Z0qnlQL E5Ww== X-Gm-Message-State: AOJu0YxJfMu3PSDI5VDshnm6nRD8O5Oe3XvK7GFx6uXk1YxNqX30uvjL MquaAUtRXFGvInv/NDogiS3XgLi2Awk7IuXnR1l3S6HdBbMJAUo76iWboTVqJly2yJ0O/0+lYBv xG67GW4tWVLtE6etvk4MX0igVjx+pfy14HtqiVyo= X-Gm-Gg: ASbGnctnt+AT10BoSG7ojBE5daybKJF8rSDExTMYmI5VJdeaj+yYY9/T4hGmCnIsfWP flmONeF7Vwm0G4/ebKwXur5wkTalNCTT+tRL3cCoM726VzvShbhX+O7+BiV72jRo5DRUodBwQAP EDW5ZamKZXaumubJUnudQ03fCzX25bwQqDMPnE7u6DKVLTzR5NsudppGYSyvRvBI5gI1Be1es7E SoUOT564HuEgtkIgN01oIp6qSB9 X-Google-Smtp-Source: AGHT+IH6YFkogW0tPD83x47ejyH2W+3xnl5hOd1419Kst0tzBdzQ9WCBvq9vU4+0bCe95ObHFmmp/6+CT9As2ksElcU= X-Received: by 2002:a05:6000:1448:b0:3c5:f975:5f97 with SMTP id ffacd0b85a97d-3cbb15ca266mr8843757f8f.16.1756378027982; Thu, 28 Aug 2025 03:47:07 -0700 (PDT) MIME-Version: 1.0 From: Liu Hui Date: Thu, 28 Aug 2025 18:47:00 +0800 X-Gm-Features: Ac12FXzvBg2EN9CRLFwIw4cJDqt3pBzPRNaQJOWIWdMCoVo2CpiW5vom4pscZ3Y Message-ID: Subject: misleading ring-convert-sequence-to-ring To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=liuhui1610@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The docstring of ring-convert-sequence-to-ring says it "convert sequence SEQ to a ring", but it actually ignores any item equal to the first item, which is not mentioned: ELISP> (ring-convert-sequence-to-ring '(a a a)) (2 1 . [nil nil a]) Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (liuhui1610[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (liuhui1610[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) The docstring of ring-convert-sequence-to-ring says it "convert sequence SEQ to a ring", but it actually ignores any item equal to the first item, which is not mentioned: ELISP> (ring-convert-sequence-to-ring '(a a a)) (2 1 . [nil nil a]) ELISP> (ring-convert-sequence-to-ring '(a b c a b c)) (1 5 . [nil c b c b a]) I think either the function or the docstring need to be fixed. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 28 06:59:47 2025 Received: (at 79330) by debbugs.gnu.org; 28 Aug 2025 10:59:47 +0000 Received: from localhost ([127.0.0.1]:38526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uraM6-0004y0-Mh for submit@debbugs.gnu.org; Thu, 28 Aug 2025 06:59:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47338) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uraM4-0004x1-7g for 79330@debbugs.gnu.org; Thu, 28 Aug 2025 06:59:45 -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 ) id 1uraLy-00087j-Cu; Thu, 28 Aug 2025 06:59:38 -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=Ixv+nH/savcBXV4ZJ+bqdS+ZSwLV0NAVlwvYJQZP2V4=; b=LenzuCu8aDk0 vtICyQkdvvU62Gqh7ee14XhCXo+yyKWsn9AeV5nSAbggGgXiJ5XsHRhO5DvWv5MmS1FPpk1HiPOMx PoCj+VjrLt/LMoSwWVJAgpPKKkRjGeLZ5Re/y5HfZAW2zEKFFOxkKhylMBntPQ2Itg3JMnLeEOuHl gjpcS8sabMc92GHv3E+D151zkdCd3R4sxNNn6y/MppmzSWi4l/YwUcKzGGb7LTNyMFaddnaX6phN7 +0NR7YGGvII8NfBkxOXKkBeLJ9FH3ayraYM4uQlw6JhYSQ8RZgmCFBf7v/yVHbHU4lZroYRqqXjy/ 1NIvgE6DySMRq4E4wiBxBQ==; Date: Thu, 28 Aug 2025 13:59:33 +0300 Message-Id: <86tt1rsodm.fsf@gnu.org> From: Eli Zaretskii To: Liu Hui In-Reply-To: (message from Liu Hui on Thu, 28 Aug 2025 18:47:00 +0800) Subject: Re: bug#79330: misleading ring-convert-sequence-to-ring References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79330 Cc: 79330@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --text follows this line- > From: Liu Hui > Date: Thu, 28 Aug 2025 18:47:00 +0800 > > The docstring of ring-convert-sequence-to-ring says it "convert > sequence SEQ to a ring", but it actually ignores any item equal to the > first item, which is not mentioned: > > ELISP> (ring-convert-sequence-to-ring '(a a a)) > (2 1 . [nil nil a]) > > ELISP> (ring-convert-sequence-to-ring '(a b c a b c)) > (1 5 . [nil c b c b a]) > > I think either the function or the docstring need to be fixed. To decide whether we can fix the code would need to look at the existing users of this function (not only in our tree), since it works like it works for the last 18 years. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 28 23:35:39 2025 Received: (at 79330) by debbugs.gnu.org; 29 Aug 2025 03:35:40 +0000 Received: from localhost ([127.0.0.1]:41109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1urptn-0001S6-Rs for submit@debbugs.gnu.org; Thu, 28 Aug 2025 23:35:39 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:45269) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1urpti-0001Qc-GK for 79330@debbugs.gnu.org; Thu, 28 Aug 2025 23:35:32 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3cdfb1ff7aeso785280f8f.2 for <79330@debbugs.gnu.org>; Thu, 28 Aug 2025 20:35:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756438523; x=1757043323; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=GVp7hLRydQRObo5v/dnTNr+lPagGebEiZKNPWbmt7V4=; b=WneUXu2O6qNI32iAh3T20YvPKalXk/TG3kD8tsxhz2Qzyfwd7b+wfJvNRseCXeRlVj pLMN66aQ6a0zfg1bZyGydjhZq96dpRRR19nuZyRXNt2a7FCyBW5dNLw/CJyoGXf8KhCL h1GuqlAepULOfI9O+f/wAhdoRHyuzHaI31bYaY6FfFdeIQ30+1WYwV9fJ3wqv6peti+D ewyX+7ZRmobW+pGrNuxUrSIZSPAX/iCXqBqg/BAvh8IvBqcNmGx+SdEVyEXk1/SodWHK MJ46PEhjaDacPsohvk8clRPWWarcHc9cNZ76NKSLaDyUtdSJmTqrTgGn1qUCncQafIAi ulbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756438523; x=1757043323; h=content-transfer-encoding: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=GVp7hLRydQRObo5v/dnTNr+lPagGebEiZKNPWbmt7V4=; b=jYY4kxRp1RYEEwY/i1S9MtxDB4w74xYlNItcmKjLNS4RXOp3PWoTBh5qyw9PXB+B7w EZN/grcux3bsbM6MHMa9KZ2WcLTrxk7GYOhlnekmOt5/Xgg3NE8s306yDCYvlJO+LF18 juLPaIgsPjZX0Ug/Ffv6dYx0Pau3W2urHq/QcpVaBDdyU78RNcg90bOkOxhGa8RFg7yt elgiDodJTGEmxgS2DozxYAz1On9AnQ0xWGh1uKzbJQiqsh3hpG96Xysr/SNhFI1q/Jsp mBKuXoOijMZ1DfUuk1sj8CD4plKqKsw3iIUIP/gA6m/friNb3SiJqfd02QS0mtl5m46j Tnvw== X-Gm-Message-State: AOJu0YzWDKsuOuOryjAaacH5Dp1PcbSEjoDZrzhqxXUdL+rQ1HOxTlIt hgiMjo2B1W2lveYJ/7L57d9nQiPvA4fHjJqZZ3hs5Ej41MdhiDxpZiQKlUS7Wz5xMTlU1KxUDe9 bEhiX7oCvbAFRaJw4WH1pdu1CJPuHibk= X-Gm-Gg: ASbGncuJoMtSZmXEC1Dl4ve+805L+hD8cgRRh9CXratTP/5PbaKM8Gud9nV2zdmjdHh wevwm6K53hQVIcDYQIKggpuy2H/ktm9GrGIBGXdZJRgR215lkI5XB2S8Rc1gHTdNIg5McG7OSTL j5qsStHVV4nmnkOMDtoxm+w+/hSMQk89X/7kL5Sy1hSBBHFzopPIqYZ/uHjglY4pLIJOq13EHpg DEBHKM4Dd0QwxVjGw== X-Google-Smtp-Source: AGHT+IFkNK2XeupRS049R8zlEVQfW8yezXIvC+GoGfhlmHOgrbNHbrrldYU9lHh2fnzaVM52hQR+t5qeMQ+BFWCetZE= X-Received: by 2002:a05:6000:18a8:b0:3c8:e475:6ed6 with SMTP id ffacd0b85a97d-3c8e475777emr14835290f8f.62.1756438523211; Thu, 28 Aug 2025 20:35:23 -0700 (PDT) MIME-Version: 1.0 References: <86tt1rsodm.fsf@gnu.org> In-Reply-To: <86tt1rsodm.fsf@gnu.org> From: Liu Hui Date: Fri, 29 Aug 2025 11:35:11 +0800 X-Gm-Features: Ac12FXxbc0jnmPrbrjQ61ZOo8sjvmVS46C0uxbxBsG15qjWPtl8F47416bZbGKE Message-ID: Subject: Re: bug#79330: misleading ring-convert-sequence-to-ring To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 79330 Cc: 79330@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Thu, Aug 28, 2025 at 6:59=E2=80=AFPM Eli Zaretskii wrote: > > --text follows this line- > > From: Liu Hui > > Date: Thu, 28 Aug 2025 18:47:00 +0800 > > > > The docstring of ring-convert-sequence-to-ring says it "convert > > sequence SEQ to a ring", but it actually ignores any item equal to the > > first item, which is not mentioned: > > > > ELISP> (ring-convert-sequence-to-ring '(a a a)) > > (2 1 . [nil nil a]) > > > > ELISP> (ring-convert-sequence-to-ring '(a b c a b c)) > > (1 5 . [nil c b c b a]) > > > > I think either the function or the docstring need to be fixed. > > To decide whether we can fix the code would need to look at the > existing users of this function (not only in our tree), since it works > like it works for the last 18 years. I have checked the only one usage (i.e. eshell-index-value) in emacs and many other examples in github. I think all users don't expect to ignore an item that is equal to the first item. For example: 1. emacs -Q 2. (setq eshell-history-file-name nil) 3. M-x eshell 4. type the following commands separately in eshell buffer echo 1 echo 2 echo 1 echo 2 echo $eshell-history-ring[-4..] There should be four items in the last output, but actually three items due to ring-convert-sequence-to-ring. In other cases, the SEQ usually contains different items, so it works in these years. From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 06 04:39:07 2025 Received: (at 79330) by debbugs.gnu.org; 6 Sep 2025 08:39:07 +0000 Received: from localhost ([127.0.0.1]:34188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uuoRu-0003a5-N2 for submit@debbugs.gnu.org; Sat, 06 Sep 2025 04:39:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51764) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uuoRr-0003Z0-0j for 79330@debbugs.gnu.org; Sat, 06 Sep 2025 04:39:03 -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 ) id 1uuoRl-0005n7-Em; Sat, 06 Sep 2025 04:38:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Vo20JN4pHHfNLVhT9rctJ8qlAWBvFMCbn4gEk9PlgYY=; b=MlJvefhfTHTmkHDlGn4V WEjrx6yTBQedGrG1kRM2eAETncuT0dJ9nH3Uipn1pem8tR4lsfaNRDUoc9rmpbznr1mBB7eFNDrhB qrT/3gixNg9GWpDR3AwNF4pns3nVUOGBZ4Lskl971AsrzZsVdCrFLJa64HDDZDzf4j9EUQswIsEZ3 wvo3yMEzGixsw+Ib1enFH1ZpH/cRFDyHQLRUEMgSFXnWNCN76GFvhGxu/NQ1sz1+5gIPfeaz7CoFJ 2/gtAZaEI5EUqpYzwL6/VtDz0F5S0yFAqLAOLemoXB+8bQNYPIsMo27o0rNGh68Hx8ilJ7LiCyHXV pPWtEKe1f47xFg==; Date: Sat, 06 Sep 2025 11:38:54 +0300 Message-Id: <86zfb8f00x.fsf@gnu.org> From: Eli Zaretskii To: Liu Hui , Stefan Monnier In-Reply-To: (message from Liu Hui on Fri, 29 Aug 2025 11:35:11 +0800) Subject: Re: bug#79330: misleading ring-convert-sequence-to-ring References: <86tt1rsodm.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79330 Cc: 79330@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Liu Hui > Date: Fri, 29 Aug 2025 11:35:11 +0800 > Cc: 79330@debbugs.gnu.org > > On Thu, Aug 28, 2025 at 6:59 PM Eli Zaretskii wrote: > > > > --text follows this line- > > > From: Liu Hui > > > Date: Thu, 28 Aug 2025 18:47:00 +0800 > > > > > > The docstring of ring-convert-sequence-to-ring says it "convert > > > sequence SEQ to a ring", but it actually ignores any item equal to the > > > first item, which is not mentioned: > > > > > > ELISP> (ring-convert-sequence-to-ring '(a a a)) > > > (2 1 . [nil nil a]) > > > > > > ELISP> (ring-convert-sequence-to-ring '(a b c a b c)) > > > (1 5 . [nil c b c b a]) > > > > > > I think either the function or the docstring need to be fixed. > > > > To decide whether we can fix the code would need to look at the > > existing users of this function (not only in our tree), since it works > > like it works for the last 18 years. > > I have checked the only one usage (i.e. eshell-index-value) in emacs > and many other examples in github. I think all users don't expect to > ignore an item that is equal to the first item. For example: > > 1. emacs -Q > 2. (setq eshell-history-file-name nil) > 3. M-x eshell > 4. type the following commands separately in eshell buffer > > echo 1 > echo 2 > echo 1 > echo 2 > echo $eshell-history-ring[-4..] > > There should be four items in the last output, but actually three > items due to ring-convert-sequence-to-ring. > > > In other cases, the SEQ usually contains different items, so it works > in these years. Thanks. I have no idea what is the significance of the first element of the ring, and why no other element should be inserted that is equal to that. I could understand it if any consecutive 'equal' elements were inserted only once, but that is not what the function does. Stefan, any ideas why the code works as it is, and what, if anything, we should do here? From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 07 11:11:38 2025 Received: (at 79330) by debbugs.gnu.org; 7 Sep 2025 15:11:38 +0000 Received: from localhost ([127.0.0.1]:45034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uvH3F-00034v-BM for submit@debbugs.gnu.org; Sun, 07 Sep 2025 11:11:38 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:56409) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uvH37-00034W-8i for 79330@debbugs.gnu.org; Sun, 07 Sep 2025 11:11:30 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id B1150816A0; Sun, 7 Sep 2025 11:11:19 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1757257879; bh=G8FX5P//tojisKahASH8t6zrhjrZXQGphGv371KEZNU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=EqC/cAMQuLeyekhxuvYyewzc2QH7ldbdoV27H9KsobJL57I3+WPpSnkFBrLGUSr0o tEOsmdC1VA/J9qIRHJagTJ5ghKfvZRdaXtOU/5i8joPUZCBr6p3ZG5I7bsA9a+4Wxu u/5msDGVRW1goIspxOpq+ImD8BaVMJ3eklm2QgQ5Yzxd7CBs6mX4yuv5oWv5CD8UEd SxzvV6KP6bUA+9yXP9Q32Vo/U4HN2dk78X+nSgU3KanbWqlRfyn7wx+Du6bF4HyZDY Bv0Go+Gg4LxElMeTRcTBDg1Wg+cEuufE1eF3VQ72wr/3wGXBXyvqeElySP8/uchVXh e9ST2Pye6mjRg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id EE1F9807F5; Sun, 7 Sep 2025 11:11:18 -0400 (EDT) Received: from pastel (104-195-222-212.cpe.teksavvy.com [104.195.222.212]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C24C11203DB; Sun, 7 Sep 2025 11:11:18 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#79330: misleading ring-convert-sequence-to-ring In-Reply-To: <86zfb8f00x.fsf@gnu.org> Message-ID: References: <86tt1rsodm.fsf@gnu.org> <86zfb8f00x.fsf@gnu.org> Date: Sun, 07 Sep 2025 11:11:18 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.114 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79330 Cc: Liu Hui , 79330@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > I have no idea what is the significance of the first element of the > ring, and why no other element should be inserted that is equal to > that. I could understand it if any consecutive 'equal' elements were > inserted only once, but that is not what the function does. > > Stefan, any ideas why the code works as it is, and what, if anything, > we should do here? It's a part of the ring code I do not understand either, I'm afraid. Stefan