From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72511: 30.0.50; prefix-completions is always nil in help--symbol-completion-table Date: Wed, 14 Aug 2024 11:50:47 -0400 Message-ID: References: <20240807135305.189c2c3e@cdr> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26369"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 72511@debbugs.gnu.org To: Chris Roberts Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 14 17:51:45 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1seGHo-0006e4-OH for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Aug 2024 17:51:45 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1seGHY-0007lF-No; Wed, 14 Aug 2024 11:51:28 -0400 Original-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 1seGHX-0007fM-58 for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 11:51:27 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1seGHW-0002TJ-Rq for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 11:51:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=K0zUS9aEdYxA4PQY1sX88lapdung+hcVvAKO5nBXE6g=; b=gmkwqxvr5wb4j0emJmE3jxU0jjP4E8GnKaWXq9afAlXvOnTZKGmeTdSmJGhL0O/Qc0lzwjiO+lsbQ8Ji+rbNqC9p2X/An6J5vYCx1hfjwxajgJgBejxwqxRVQNg+dWrvGyZ6PKhGwd+qY6/5VraBElqQTVzhw+UL6hRPaqj6S2kH9F5aA8MKC/JuN5Zx17/5V5x7ppS3fyQ0tVmFw9v1BLNXLmgToavgLs16YYqg62+JJObm5eW3Okk8k3eOIg6insxHQUDEu4hBaaUjzT5Wi6LJviKQEodL9wUPKUgszh+SNnG1nulzAQJC5yOiNQmOSZU4pRAwdP/m06XQCBP/NA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1seGI5-0000SZ-P6 for bug-gnu-emacs@gnu.org; Wed, 14 Aug 2024 11:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Aug 2024 15:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72511 X-GNU-PR-Package: emacs Original-Received: via spool by 72511-submit@debbugs.gnu.org id=B72511.17236507111747 (code B ref 72511); Wed, 14 Aug 2024 15:52:01 +0000 Original-Received: (at 72511) by debbugs.gnu.org; 14 Aug 2024 15:51:51 +0000 Original-Received: from localhost ([127.0.0.1]:47287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seGHu-0000S6-Px for submit@debbugs.gnu.org; Wed, 14 Aug 2024 11:51:51 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:32304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seGHs-0000Rp-De for 72511@debbugs.gnu.org; Wed, 14 Aug 2024 11:51:49 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 75710442BCE; Wed, 14 Aug 2024 11:51:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1723650665; bh=OKpWq0O25B+dM7gcrd/VWmrhnv8cSlf6NJhMeqXJoHA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=l/wRgRmbMCH/CHVCyzXbBaEX26PYIyMKr9P20AmEOjVrS7BvZpd7HIe0k0hJMk0Y8 1U84croe35l9Vxjsri46XmhFgLEo+pJ6XAg8CgIpfAnp5A74OddHMwvujk6Er2txwy AP9t+WNkjJT2tj5O2BuDQVYjcTGlpxD1eDGrBb6ULAQs4VXswT47kfVmXc/AdefEuv V6RZefn3HOCw9LzA+BATNy7256N6yz2Qjwx9e3Tu7HVI7DXv6V54bwiufMZmvf2YDw Acb26IJrS8RuGpXAXp7B8EXXzd/ebuyI1r8vHqdNAPGQdf5/Aa0Zjbrk1OBO7kXve/ ezqfg854jgt7A== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C1254442648; Wed, 14 Aug 2024 11:51:05 -0400 (EDT) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B34D41205CC; Wed, 14 Aug 2024 11:51:05 -0400 (EDT) In-Reply-To: <20240807135305.189c2c3e@cdr> (Chris Roberts's message of "Wed, 7 Aug 2024 13:53:05 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290149 Archived-At: > (when help-enable-completion-autoload > (let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string))) > (help--load-prefixes prefixes))) > (let ((prefix-completions > (and help-enable-completion-autoload > (mapcar #'intern (all-completions string definition-prefixes))))) > > By default, `help-enable-completion-autoload' is t, so this code should > normally run. The perceived problem here is that the definition of > `help-definition-prefixes' function is as follows: > > (defun help-definition-prefixes () > "Return the up-to-date radix-tree form of `definition-prefixes'." > (when (> (hash-table-count definition-prefixes) 0) > (maphash (lambda (prefix files) > (let ((old (radix-tree-lookup help-definition-prefixes prefix))) > (setq help-definition-prefixes > (radix-tree-insert help-definition-prefixes > prefix (append old files))))) > definition-prefixes) > (clrhash definition-prefixes)) > help-definition-prefixes) > > Because of the `clrhash', `definition-prefixes' will always be empty > after the function call to `help-definition-prefixes'. Duh, indeed. IIRC it's a leftover from some older version of the code. I think the patch below is in order. > Also, was clearing out the entirety of `definition-prefixes' on completion > really the intended behavior? Originally, yes (after which we'd just use the `help-definition-prefixes` radix-tree instead), but then other places appeared where using the radix-tree was not convenient. Stefan diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 0a469a1fd6d..e3dc23036db 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -86,14 +86,14 @@ help-definition-prefixes (defun help-definition-prefixes () "Return the up-to-date radix-tree form of `definition-prefixes'." - (when (> (hash-table-count definition-prefixes) 0) + (when (and (null help-definition-prefixes) + (> (hash-table-count definition-prefixes) 0)) (maphash (lambda (prefix files) (let ((old (radix-tree-lookup help-definition-prefixes prefix))) (setq help-definition-prefixes (radix-tree-insert help-definition-prefixes prefix (append old files))))) - definition-prefixes) - (clrhash definition-prefixes)) + definition-prefixes)) help-definition-prefixes) (defun help--loaded-p (file)