From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#35206: [PATCH] Misleading `list-get' argument description Date: Tue, 9 Apr 2019 12:34:09 +0200 Message-ID: <77179D00-DAC7-41E9-BC76-4F0824DC57EF@acm.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_00054EE5-5896-460D-8274-3C58FEECBAED" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="247261"; mail-complaints-to="usenet@blaine.gmane.org" To: 35206@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 09 12:37:07 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 1hDo7k-0012AC-1g for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Apr 2019 12:37:04 +0200 Original-Received: from localhost ([127.0.0.1]:38818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDo7i-0002MP-Rp for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Apr 2019 06:37:02 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDo5n-0000eK-R1 for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 06:35:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDo5m-0000Q6-QW for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 06:35:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37048) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hDo5m-0000Q1-Ko for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 06:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hDo5m-00018g-Gt for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 06:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Apr 2019 10:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35206 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15548060664321 (code B ref -1); Tue, 09 Apr 2019 10:35:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Apr 2019 10:34:26 +0000 Original-Received: from localhost ([127.0.0.1]:50592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDo5B-00017d-Lz for submit@debbugs.gnu.org; Tue, 09 Apr 2019 06:34:25 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34271) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hDo5A-00017O-3d for submit@debbugs.gnu.org; Tue, 09 Apr 2019 06:34:24 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:37829) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDo54-000081-UO for submit@debbugs.gnu.org; Tue, 09 Apr 2019 06:34:19 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hDo53-0008Rk-Ui for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 06:34:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hDo53-00006l-0s for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 06:34:17 -0400 Original-Received: from mail234c50.megamailservers.eu ([91.136.10.244]:55796 helo=mail37c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hDo50-0008SO-Np for bug-gnu-emacs@gnu.org; Tue, 09 Apr 2019 06:34:16 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1554806051; bh=xfn0M9yntf8tzfgDvNI8deA8+LeBE/BbT3N7VlLia0g=; h=From:Subject:Date:To:From; b=YY8qYs0b7153ih8DV02+WbBiVAqjA5Q2yelMeNKwWqgb2J8B3/XFUvxOxgPXK8wcM b4poJnDLGJbrYzbm1gVVzqIkN1cvnSYS66xZtiVHhysuCLYErakB4Z8A8B55xu0pqn Z/kt81COnilf6JB/2ADe+k3X2TDab3dqGrRNgb6s= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.1.64] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail37c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x39AY9Nw016034 for ; Tue, 9 Apr 2019 10:34:11 +0000 X-Mailer: Apple Mail (2.3445.104.8) X-CTCH-RefID: str=0001.0A0B0212.5CAC7523.0052, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=P4AUeBIu c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=6mM8A04KtBac0AcifZkA:9 a=CjuIK1q_8ugA:10 a=3AWlWoJxXYAfIhdo_BkA:9 a=B2y7HmGcmWMA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:157403 Archived-At: --Apple-Mail=_00054EE5-5896-460D-8274-3C58FEECBAED Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The doc string for `list-get' says Use TESTFN to lookup in the alist if non-nil. Otherwise, use `assq'. which is misleading since it's an equality predicate, not a look-up = function, and the default is `eq', not `assq'. How about changing it to Equality is defined by TESTFN or by `eq' if nil or omitted. --Apple-Mail=_00054EE5-5896-460D-8274-3C58FEECBAED Content-Disposition: attachment; filename=0001-Clarify-the-TESTFN-argument-to-alist-get.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Clarify-the-TESTFN-argument-to-alist-get.patch" Content-Transfer-Encoding: quoted-printable =46rom=200bdfa84e6c55ff97286818b42ed3e6f035d47151=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Tue,=209=20Apr=202019=2012:27:30=20+0200=0A= Subject:=20[PATCH]=20Clarify=20the=20TESTFN=20argument=20to=20= `alist-get'=0A=0A*=20lisp/subr.el=20(alist-get):=20Clarify=20the=20= meaning=20of=20the=20TESTFN=20argument.=0AIt's=20an=20equality=20= predicate,=20not=20a=20look-up=20function.=0A---=0A=20lisp/subr.el=20|=20= 2=20+-=0A=201=20file=20changed,=201=20insertion(+),=201=20deletion(-)=0A=0A= diff=20--git=20a/lisp/subr.el=20b/lisp/subr.el=0Aindex=20= 45b3916196..5eb6a53f78=20100644=0A---=20a/lisp/subr.el=0A+++=20= b/lisp/subr.el=0A@@=20-781,7=20+781,7=20@@=20Elements=20of=20ALIST=20= that=20are=20not=20conses=20are=20ignored."=0A=20(defun=20alist-get=20= (key=20alist=20&optional=20default=20remove=20testfn)=0A=20=20=20"Return=20= the=20value=20associated=20with=20KEY=20in=20ALIST.=0A=20If=20KEY=20is=20= not=20found=20in=20ALIST,=20return=20DEFAULT.=0A-Use=20TESTFN=20to=20= lookup=20in=20the=20alist=20if=20non-nil.=20=20Otherwise,=20use=20= `assq'.=0A+Equality=20is=20defined=20by=20TESTFN=20or=20by=20`eq'=20if=20= nil=20or=20omitted.=0A=20=0A=20You=20can=20use=20`alist-get'=20in=20= PLACE=20expressions.=20=20This=20will=20modify=0A=20an=20existing=20= association=20(more=20precisely,=20the=20first=20one=20if=0A--=20=0A= 2.20.1=20(Apple=20Git-117)=0A=0A= --Apple-Mail=_00054EE5-5896-460D-8274-3C58FEECBAED--