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#60628: 29.0.60; apropos-documentation does not work for preloaded symbols Date: Fri, 13 Jan 2023 10:46:21 -0500 Message-ID: References: <83o7rascqg.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26629"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 60628@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 13 17:30:38 2023 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 1pGMwv-0006cr-6v for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Jan 2023 17:30:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pGMGm-0001zX-RP; Fri, 13 Jan 2023 10:47:04 -0500 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 1pGMGk-0001yW-Gf for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 10:47:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pGMGk-0006K4-5U for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 10:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pGMGj-0008HW-Hx for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 10:47:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Jan 2023 15:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60628 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167362480831815 (code B ref -1); Fri, 13 Jan 2023 15:47:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Jan 2023 15:46:48 +0000 Original-Received: from localhost ([127.0.0.1]:52192 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGMGV-0008H5-FY for submit@debbugs.gnu.org; Fri, 13 Jan 2023 10:46:47 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:55378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGMGS-0008Gu-RP for submit@debbugs.gnu.org; Fri, 13 Jan 2023 10:46:45 -0500 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 1pGMGL-0001i5-Rd for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 10:46:38 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGMGJ-00068H-Nh; Fri, 13 Jan 2023 10:46:37 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 9CAB91000E7; Fri, 13 Jan 2023 10:46:28 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 99B2E1000C9; Fri, 13 Jan 2023 10:46:22 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1673624782; bh=Mc2sa16mFQnDN9aqvAHZW6bKRIQEIzlGwK0YsRbrOiM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=VN6G/BqTPYtCAmFxqZrlYSi5zal0lmqGbsEJFgncO9iJvQb4dwP+OAW9x9V12MHux fVEbf1nL+wdqOMZtU0878U3AWSyQy1g8rIhzsL7rr0GnWCa652gRSKU6SwDBu4SHta /wkINQMu68CYH7emFFECv9kUE56T83RKzJBPXYGmYaBu10cI96T0CDnkyVyqXwkFDW mnO4MlktzIkeYCOqdjFtKm0Ygy6h7zrhPiKC1Bsiz1afoy8Mk6Uj5rEgldBb6Hnu88 SXNY4aoRLEUoU1T6CzBg4Y2N7J33Q5U5bwDZ7FRdqSpmdX8pstUhSvo4+2N4IG7NXJ PAL3leqvzIckA== Original-Received: from alfajor (unknown [45.44.229.252]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 56C71120FA2; Fri, 13 Jan 2023 10:46:22 -0500 (EST) In-Reply-To: <83o7rascqg.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 07 Jan 2023 15:20:07 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:253299 Archived-At: > The doc string of apropos-documentation does say: > > Note that by default this command only searches in the file specified by > =E2=80=98internal-doc-file-name=E2=80=99; i.e., the etc/DOC file. With= C-u prefix, > or if =E2=80=98apropos-do-all=E2=80=99 is non-nil, it searches all curr= ently defined > documentation strings. > > However, since we no longer write the doc strings of preloaded Lisp > files to DOC, that default no longer makes sense: Emacs should not > distinguish between built-in primitives and preloaded stuff, and it > didn't up to and including Emacs 28. Well, we still do as documented. It's just that what is covered by =E2=80=98internal-doc-file-name=E2=80=99 is different now :-) IOW, we should also fix the doc so it doesn't define the behavior based on internal details such as =E2=80=98internal-doc-file-name=E2=80=99. We s= hould probably say that by default we only search through the predefined functions or something like that. And as for actually (re)implementing that behavior, we can probably do it by replacing `mapatoms` with a loop through the elements of `load-history` corresponding to the `preloaded-file-list`. > and in that case apropos-documentation-internal calls > apropos-documentation-check-elc-file, which does something very > strange: it only looks inside strings that begin with "\n#@", and > otherwise simply ignores everything else. Is this also a remnant from > back when preloaded files had their doc strings in etc/DOC? Hmm... oh I see, it's because of that Stefan dude: commit 900b09c0235d54d56ef5e88d04cca61bc71cbbb7 Author: Stefan Monnier Date: Fri Aug 5 08:18:04 2022 -0400 =20=20=20=20 bytecomp.el: Further simplifications enabled by commit 59732a83c887= 5c =20=20=20=20=20=20=20=20 * lisp/emacs-lisp/bytecomp.el (byte-compile-output-docform): Don't insert a \n before the #@ docstrings since make-docfile doesn't scan .elc files any more. But searching for "#@" (with or without a \n) is not a good idea anyway, since there can be false positives and because once we've found such a "docstring" in a .elc file the problem of finding who this docstring belongs to again depends on details of how `bytecomp.el` decides to print out the code. For `emacs-29` the better option is probably to just revert the above commit. And for `master` we should probably rewrite the code so it uses the POS info in the (FILE . POS) instead of searching for #@, but that requires a significant rewrite. Basically, we should loop through all the functions, collecting their (FILE . POS) data, grouping them by FILE, so we end up for every FILE with a list of (FUNCTION . POS) so we can just jump to POS without having to search for #@ (we can still check the presence of #@ as sanity check). Stefan