GNU bug report logs - #37450
26.3; `all-completions' PREDICATE for a hash table COLLECTION

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; Reported by: Drew Adams <drew.adams@HIDDEN>; dated Wed, 18 Sep 2019 18:03:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 37450) by debbugs.gnu.org; 18 Sep 2019 18:28:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 18 14:28:16 2019
Received: from localhost ([127.0.0.1]:54810 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iAegZ-0003Fu-L3
	for submit <at> debbugs.gnu.org; Wed, 18 Sep 2019 14:28:15 -0400
Received: from aserp2120.oracle.com ([141.146.126.78]:60248)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1iAegX-0003Ff-VU
 for 37450 <at> debbugs.gnu.org; Wed, 18 Sep 2019 14:28:14 -0400
Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1])
 by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8IIJLHR081724
 for <37450 <at> debbugs.gnu.org>; Wed, 18 Sep 2019 18:28:08 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05;
 bh=b86sbSELuyjK4IfYjvvQPyDk9MYJWcxEDljNTWxfDCw=;
 b=S++qDEZbB3dfoOo2iBxEWohSkPXDa++5wjIML6053zxvMB0L4XfzX7sqUUbneapV0OYb
 Pxk3qKBtrR+dHM5LOBN28Hcl0jAoSbGXCq82YlnhAN/r/6LZ4BeKXuDsw4S8BaVhwxYA
 0JdjjpWbiTe5N/sDwk1/9CG1oYvBLuSnhA7SKjXbWA2YP8dmdOWPVKTOSkaRbqRBx4pf
 FpvAYfoCaxkGI5gnTh8f59YyBgSWTzqjPVZzL9KccQCeQA2IMXuj9QpxYfKArrAKA7sJ
 ACXzMdeXGvSnHgYVAZa4vxzccnhze2bWGimKv+PcmVcYwpEcXfoP0PcVFxdECCt+6JAA sA== 
Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71])
 by aserp2120.oracle.com with ESMTP id 2v385e5rbu-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
 for <37450 <at> debbugs.gnu.org>; Wed, 18 Sep 2019 18:28:07 +0000
Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1])
 by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8IIIZEY020734
 for <37450 <at> debbugs.gnu.org>; Wed, 18 Sep 2019 18:26:07 GMT
Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75])
 by aserp3030.oracle.com with ESMTP id 2v37ma384w-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
 for <37450 <at> debbugs.gnu.org>; Wed, 18 Sep 2019 18:26:07 +0000
Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20])
 by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x8IIQ6GY009189
 for <37450 <at> debbugs.gnu.org>; Wed, 18 Sep 2019 18:26:06 GMT
MIME-Version: 1.0
Message-ID: <7d0182de-dba2-4850-b3c5-6ae6b336c44b@default>
Date: Wed, 18 Sep 2019 11:26:05 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: 37450 <at> debbugs.gnu.org
Subject: RE: bug#37450: 26.3; `all-completions' PREDICATE for a hash table
 COLLECTION
References: <140d4456-6455-4e48-b3a4-db9b13d6787a@default>
In-Reply-To: <140d4456-6455-4e48-b3a4-db9b13d6787a@default>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4888.0 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9384
 signatures=668685
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=13
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1908290000 definitions=main-1909180162
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9384
 signatures=668685
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=13 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000
 definitions=main-1909180162
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 37450
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 (---)

> (all-completions orig
>                  THE-BBDB-ALIST
>                  (lambda (sym)
>                     (when (bbdb-completion-predicate sym)
>                       (push sym all-comps))))
>=20
> I had to change that to this, adding an (unused?) arg for the PREDICATE:
>=20
> (all-completions orig
>                  bbdb-hashtable'
>                  (lambda (sym __)
>                     (when (bbdb-completion-predicate sym)
>                       (push sym all-comps))))

I shouldn't have been so definitive about that "fix".
It apparently didn't work - the user now reports a
different error message, saying "Something like two
arguments but expected one."  I don't use BBDB, so
I'm flying a bit blind on this.

Hope my bug report makes some sense in any case.
My question seems reasonable, at least in my relative
ignorance: why must the PREDICATE take also a VALUE
arg when COLLECTION is a hash table?  Why isn't KEY
lookup sufficient?




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

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


Received: (at submit) by debbugs.gnu.org; 18 Sep 2019 18:02:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 18 14:02:15 2019
Received: from localhost ([127.0.0.1]:54799 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iAeHN-0002a5-Kb
	for submit <at> debbugs.gnu.org; Wed, 18 Sep 2019 14:02:15 -0400
Received: from lists.gnu.org ([209.51.188.17]:50995)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1iAeHL-0002Zx-K0
 for submit <at> debbugs.gnu.org; Wed, 18 Sep 2019 14:02:12 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45569)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <drew.adams@HIDDEN>) id 1iAeHK-0001Hm-2n
 for bug-gnu-emacs@HIDDEN; Wed, 18 Sep 2019 14:02:11 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_MED
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1iAeHI-0008Is-CN
 for bug-gnu-emacs@HIDDEN; Wed, 18 Sep 2019 14:02:09 -0400
Received: from userp2120.oracle.com ([156.151.31.85]:49508)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <drew.adams@HIDDEN>)
 id 1iAeHI-0008Hy-2y
 for bug-gnu-emacs@HIDDEN; Wed, 18 Sep 2019 14:02:08 -0400
Received: from pps.filterd (userp2120.oracle.com [127.0.0.1])
 by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8IHx3or103916
 for <bug-gnu-emacs@HIDDEN>; Wed, 18 Sep 2019 18:02:05 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : subject : content-type :
 content-transfer-encoding; s=corp-2019-08-05;
 bh=UK3H5UVZb1t79tqcW6yL8/pTje0aW2ii1S+9yDccMv8=;
 b=Rh8Vw5OAYBefdCH4Z+z4i5aFEAxUIpfcJficGXz0I92HqCxl0lpmeswcoLmM6r/3DHyF
 WF8h/yD0jShaMT55rVsLadb60UVA5eGYnAZYdRgMvYY0g6v6vsTjNsTGLZS6f8Y/Ll0r
 ghqypzHaBqqPX68QnNj5DjTmEU1jqB4nZLpxh5fXqu3OoKHapFknwBgox8V4SB40lEz5
 HKNfRhZsmIZpTJcbQGwhx96Mu8IoCIDZzvxGJkjMDYzLEt6elqVP3/bHYdFiY4D1ErHq
 8dVBLsgMf2jqTnoyCpNupEAvGvsRmHph+una0BG+ePGriI0fa6eWevFyKQY5LhYAbxH7 8g== 
Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79])
 by userp2120.oracle.com with ESMTP id 2v385dwn4t-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
 for <bug-gnu-emacs@HIDDEN>; Wed, 18 Sep 2019 18:02:05 +0000
Received: from pps.filterd (userp3020.oracle.com [127.0.0.1])
 by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8IHd6Xs054458
 for <bug-gnu-emacs@HIDDEN>; Wed, 18 Sep 2019 18:02:05 GMT
Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])
 by userp3020.oracle.com with ESMTP id 2v37mayhvm-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)
 for <bug-gnu-emacs@HIDDEN>; Wed, 18 Sep 2019 18:02:04 +0000
Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20])
 by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x8II24Br006581
 for <bug-gnu-emacs@HIDDEN>; Wed, 18 Sep 2019 18:02:04 GMT
MIME-Version: 1.0
Message-ID: <140d4456-6455-4e48-b3a4-db9b13d6787a@default>
Date: Wed, 18 Sep 2019 11:02:03 -0700 (PDT)
From: Drew Adams <drew.adams@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 26.3; `all-completions' PREDICATE for a hash table COLLECTION
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4888.0 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9384
 signatures=668685
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1908290000 definitions=main-1909180160
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9384
 signatures=668685
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000
 definitions=main-1909180161
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic]
X-Received-From: 156.151.31.85
X-Spam-Score: -1.3 (-)
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: -2.3 (--)

`C-h f all-completions' says this for this case:

  If COLLECTION is a hash-table, predicate is called with two arguments:
  the key and the value.

Why does the PREDICATE function need to accept a VALUE argument, as well
as a KEY argument?  When an alist or obarray is used, the only thing
PREDICATE needs is the KEY to look up.  I would think that that's the
only thing needed for a hash table also, logically.

I had this in one of my functions, back when `bbdb-complete-mail' used
an alist, before it changed to using hash-table `bbdb-hashtable':

(all-completions orig=20
                 THE-BBDB-ALIST
                 (lambda (sym)
                    (when (bbdb-completion-predicate sym)
                      (push sym all-comps))))

I had to change that to this, adding an (unused?) arg for the PREDICATE:

(all-completions orig=20
                 bbdb-hashtable'
                 (lambda (sym __)
                    (when (bbdb-completion-predicate sym)
                      (push sym all-comps))))

Why should the PREDICATE function need to change, now that a hash table
is used?  The VALUE arg for the PREDICATE isn't necessary for hash-table
lookup, right?  If that's right then why not have the PREDICATE accept
the KEY as a minimum?  If some code wants to additionally include a
VALUE arg, it could do that.  Can't just `all-completions' DTRT,
applying the PREDICATE to the provided KEY and VALUE if provided, else
nil for VALUE?

If `all-completions' were coded in Lisp I might take a look, to see
whether there's a good reason for PREDICATE to require 2 args when the
second arg to `all-completions' is a hash table.  So far, I'm just
wondering.  If all that's logically required is a KEY lookup, why make
an exception for hash tables, forcing the PREDICATE to accept also an
(unused?) VALUE?

In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
 of 2019-08-29
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor `Microsoft Corp.', version 10.0.17763
Configured using:
 `configure --without-dbus --host=3Dx86_64-w64-mingw32
 --without-compress-install 'CFLAGS=3D-O2 -static -g3''




Acknowledgement sent to Drew Adams <drew.adams@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#37450; 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: Mon, 25 Nov 2019 12:00:02 UTC

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