From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.bugs Subject: bug#34708: alist-get has unclear documentation Date: Mon, 11 Mar 2019 14:39:00 +0100 Message-ID: <8736ntmsy3.fsf@web.de> References: <87wolhr5k6.fsf@web.de> <87y35xdu4w.fsf@web.de> <87mumcdu7f.fsf@web.de> <875zsyhakx.fsf@ericabrahamsen.net> <87fts2h9we.fsf@web.de> <871s3mh85d.fsf@ericabrahamsen.net> <874l8iebyz.fsf@web.de> <878sxui7bo.fsf@ericabrahamsen.net> <87va0xcxco.fsf@web.de> <87h8chey12.fsf@ericabrahamsen.net> <60367f47-c0b0-45b4-8ccf-169044400a75@default> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="106884"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Eric Abrahamsen , 34708@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 11 15:03:09 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3LWD-000RXU-EF for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Mar 2019 15:03:05 +0100 Original-Received: from localhost ([127.0.0.1]:34051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3LWC-0002yf-Ay for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Mar 2019 10:03:04 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3LO5-00043E-PK for bug-gnu-emacs@gnu.org; Mon, 11 Mar 2019 09:54:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3L9v-0007LU-GZ for bug-gnu-emacs@gnu.org; Mon, 11 Mar 2019 09:40:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53373) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3L9v-0007LM-Ac for bug-gnu-emacs@gnu.org; Mon, 11 Mar 2019 09:40:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h3L9v-0000Gy-2N for bug-gnu-emacs@gnu.org; Mon, 11 Mar 2019 09:40:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Heerdegen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Mar 2019 13:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34708 X-GNU-PR-Package: emacs Original-Received: via spool by 34708-submit@debbugs.gnu.org id=B34708.1552311562995 (code B ref 34708); Mon, 11 Mar 2019 13:40:03 +0000 Original-Received: (at 34708) by debbugs.gnu.org; 11 Mar 2019 13:39:22 +0000 Original-Received: from localhost ([127.0.0.1]:38684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h3L9G-0000Fz-KU for submit@debbugs.gnu.org; Mon, 11 Mar 2019 09:39:22 -0400 Original-Received: from mout.web.de ([212.227.17.12]:37851) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h3L9E-0000Fl-Ch for 34708@debbugs.gnu.org; Mon, 11 Mar 2019 09:39:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1552311542; bh=10lAdSq3xkbcZlPuSrsBtEzSceTMtb4Arerj7z+W/rc=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=hbium+zfEOnLYp1Bx48zq94W71+inVxLtSmnKxX0f+/2yV1tp4z7vUHMoKmPTIjLR DALszbJL90pEWA49mVmj9WpVGIiBpYzJIj5QLuEEtxww3ijXP1q2LKw8bOAQzhVT1M 0G8VarPlULSNw+PfH3TVxPp/s8/e2LZxmQxyKSy8= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from drachen.dragon ([88.67.111.211]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M9os0-1hEJUj3Anw-00B39j; Mon, 11 Mar 2019 14:39:01 +0100 In-Reply-To: <60367f47-c0b0-45b4-8ccf-169044400a75@default> (Drew Adams's message of "Tue, 5 Mar 2019 16:16:19 -0800 (PST)") X-Provags-ID: V03:K1:xtpZayRRDxMzQQRl/Ato6leN2o+EDQU5aCGx5nLh9xebbe3v57J k3fDu/u1dEq3ScS5scB5FOBCxPm0Zk0XmdiHBv+jYapnLtfnAUDV5urNiBs0gozS1gsclgL 0iqrv9KD1meuy6wQf1obLgMp2cJIf11BHlLsPasBds5HtDwKPMTActx2d4di9fvEWcnLmbG 7MyBtPt1lcyG5Y9CCQhqw== X-UI-Out-Filterresults: notjunk:1;V03:K0:ZUQe67MMe3Q=:lAypgItYVDon0A9euFzKSh aZo/Efu6wAieinoJDlvI3krtR/Xflztr+ZbN/RtTxrrL34udpm4p1MW6UGEDYnuZ7Tgxe+eno aTQXfjcf/INmwGZ5/6Wa+7W5pFUoYMLuA2fETndgvo1hr+CZSfCY7sX9GGF6M+ct9KOceCIOL sM/jUw6D9SKNMi/wjVMxhdHKYKWSXD3P2ewfYL2CKbIYIblibZzX7E4fYeMcyP3doBPiq3C0E 9P2lupXDOGLq/nef/uW1OWIsSGKMGIiFcNHteIN+AqxMnbggRN3cevGYcaGthElX9iKbuxLG0 idrMgPvaZ7KF721AKN2hZbm8y7AhrvRG4g4yvv2mZrdcESqpj/4U9YcK6JzdbsBGnZiOAidqo FOjeqen7IzcMxMwJx94gwsoKgSyZBd1DXj/vsRzbzSD4Mlglym1jKd2bnu2OVzqJyMDEPs1FE 2gbnPRbqTP4GpjEjFvrB8tZNjIAGPz4WTPPZ72VeinAmnIG3BFerUBV7TfY1mVjDwW9zahd+Z JlKBSuO1HiBPDgb2aYds/JsaMCxD12AbRNbiqPnPCBBg1QMyugmds9D0r0/8iD2Vx2Rf2JtTq l8Pd5nBPOlnGeV9RL5fehXsOc7FOe7jylcnoBxiKzIfqS+3pZT+IUw/B/V3xtBrEwNoYFSEuV VBJqvZ47ZL5+hy/XwkXPFzPyQe8LkcaFU+WhhCTglCl7i6Be5h+jMPMpCohRcd+RZ1fua76Oi i3QVALoTO1572rIhrVWvo8p40SNBtaFnvoHkMVOHj2E/Amr+egvcSbz2AE5WrjDIHV41x0ll X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156230 Archived-At: Drew Adams writes: > Alists can be handled in more than one way when > setting and deleting keys. The doc needs to tell > us what `setf' with `alist-get' does to realize > these things. I agree. I'm in the middle of preparing a patch. While doing that, two questions arose: (1) "When using it to set a value, optional argument REMOVE non-nil means to remove KEY from ALIST if the new value is `eql' to DEFAULT." I wonder if there are use cases where the user wants something different than `eql'? E.g. `equal' when the associations are strings? Note that this is something different than TESTFN which is for comparing keys. (2) The remove feature has a strange corner case. Normally the first found association is removed, but if you somehow manage to add the same cons (in the sense of `eq') to the same alist, all of them are removed. Compare e.g. (progn (setq my-alist '((a . 1) (a . 1) (b . 2))) (setf (alist-get 'a my-alist nil 'remove) nil)) ;; my-alist ==> ((a . 1) (b . 2)) vs. (progn (setq my-alist '((a . 1) (b . 2))) (push (car my-alist) my-alist) ;; my-alist ==> (#1=(a . 1) #1# (b . 2)) (setf (alist-get 'a my-alist nil 'remove) nil)) ;; my-alist ==> ((b . 2)) This is because the code uses delq to delete a found cons, and delq removes all `eq' elements. Is it worth to document or change that? Michael.