From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#37450: 26.3; `all-completions' PREDICATE for a hash table COLLECTION Date: Wed, 18 Sep 2019 11:02:03 -0700 (PDT) Message-ID: <140d4456-6455-4e48-b3a4-db9b13d6787a@default> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="112625"; mail-complaints-to="usenet@blaine.gmane.org" To: 37450@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 18 20:16:22 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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iAeV1-000T3k-4P for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Sep 2019 20:16:19 +0200 Original-Received: from localhost ([::1]:34140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAeUy-0004EO-0E for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Sep 2019 14:16:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45903) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAeIE-00022b-Ri for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2019 14:03:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAeID-0000UO-I7 for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2019 14:03:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45978) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iAeIA-0000TX-AG for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2019 14:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iAeIA-0002bI-5e for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2019 14:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Sep 2019 18:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37450 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15688297359935 (code B ref -1); Wed, 18 Sep 2019 18:03:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Sep 2019 18:02:15 +0000 Original-Received: from localhost ([127.0.0.1]:54799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iAeHN-0002a5-Kb for submit@debbugs.gnu.org; Wed, 18 Sep 2019 14:02:15 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:50995) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iAeHL-0002Zx-K0 for submit@debbugs.gnu.org; Wed, 18 Sep 2019 14:02:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45569) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iAeHK-0001Hm-2n for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2019 14:02:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAeHI-0008Is-CN for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2019 14:02:09 -0400 Original-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 ) id 1iAeHI-0008Hy-2y for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2019 14:02:08 -0400 Original-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 ; 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== Original-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 ; Wed, 18 Sep 2019 18:02:05 +0000 Original-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 ; Wed, 18 Sep 2019 18:02:05 GMT Original-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 ; Wed, 18 Sep 2019 18:02:04 +0000 Original-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 ; Wed, 18 Sep 2019 18:02:04 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4888.0 (x86)] 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-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:166682 Archived-At: `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''