From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 07 08:19:52 2023 Received: (at submit) by debbugs.gnu.org; 7 Jan 2023 13:19:52 +0000 Received: from localhost ([127.0.0.1]:56706 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pE972-0001hN-2h for submit@debbugs.gnu.org; Sat, 07 Jan 2023 08:19:52 -0500 Received: from lists.gnu.org ([209.51.188.17]:33340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pE970-0001hG-0T for submit@debbugs.gnu.org; Sat, 07 Jan 2023 08:19:50 -0500 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 1pE96z-0004m8-Qh for bug-gnu-emacs@gnu.org; Sat, 07 Jan 2023 08:19:49 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pE96y-00008b-OU; Sat, 07 Jan 2023 08:19:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:To:From:Date:in-reply-to: references; bh=5HQBIgYXgF8OlnhW4d3GrBPE781si497ueCuJsZM1VY=; b=XD3VLarsXjChtg dGHlCtjLxTjg/8PZPDQ29Q4Bk8+qRKJULyiHcQMWW2lz050789KdcEUFLjTRKSyzF+RUMy+2A+ppL H7m04E67ZcO1Dj1B9kvnhayoX2y3hGhLk6fQHO6GM0EiUEvGtn6dDujB+DWLwTKcKBY0zz5Z54G90 O3dDs96FmBxFshqbVlcW0oIIQHXsonEfRs+KCmjL5E2fjccO7eaUXc4+jymzpPqAwKkG4wFr1I79k L2lbFKLUPKchdnK75h1w3/6tnWZBU2Utb8+vh60iXZMhCyg/jUB79Fxh1XBTKOroK30mkHSffxPr/ ywYFxigwJFRBvaRCwHlQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pE96y-0000w2-8d; Sat, 07 Jan 2023 08:19:48 -0500 Date: Sat, 07 Jan 2023 15:20:07 +0200 Message-Id: <83o7rascqg.fsf@gnu.org> From: Eli Zaretskii To: bug-gnu-emacs@gnu.org, Stefan Monnier Subject: 29.0.60; apropos-documentation does not work for preloaded symbols MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) To reproduce: emacs -Q C-h d list.*directory RET Note that the resulting *Apropos* buffer only lists built-in functions and variables, i.e. those defined in C. In particular, missing are functions/variables from files.el, such as find-directory-functions, parse-colon-path, and directory-files-recursively, whose doc strings all match the regexp. This seems to be due to commit 59732a83c8875c8986d2221600d559a24d8309cc Author: Stefan Monnier Date: Thu Dec 30 23:17:45 2021 -0500 Don't store docstrings of preloaded .el files in etc/DOC The doc string of apropos-documentation does say: Note that by default this command only searches in the file specified by ‘internal-doc-file-name’; i.e., the etc/DOC file. With C-u prefix, or if ‘apropos-do-all’ is non-nil, it searches all currently 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. Moreover, "C-u C-h d" also doesn't work for preloaded functions, because: (apropos-documentation-internal 'directory-files-recursively) => nil This happens because: (apropos-safe-documentation 'directory-files-recursively) => ("files.elc" . 39940) 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? Or else why does it only look for "#@" comments preceded by a newline? Basically, apropos-documentation is currently completely broken on the release branch. The following simple change seems to at least repair "C-u C-h d", but I don't think it's sufficient, as we need to resurrect the ability to find preloaded symbols without C-u. diff --git a/lisp/apropos.el b/lisp/apropos.el index b260d88..cff6f1c 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -1064,7 +1064,9 @@ apropos-documentation-check-elc-file (setq apropos-files-scanned (cons file apropos-files-scanned)) (erase-buffer) (insert-file-contents file) - (while (search-forward "\n#@" nil t) + (while (search-forward "#@" nil t) + (or (not (looking-at-p "[0-9]+")) + (progn ;; Read the comment length, and advance over it. (setq end (read) beg (1+ (point)) @@ -1110,7 +1112,7 @@ apropos-documentation-check-elc-file 'face apropos-match-face doc))) (setcar (nthcdr (if this-is-a-variable 3 2) apropos-item) - doc)))))))))) + doc)))))))))))) Ideas? patches? comments? In GNU Emacs 29.0.60 (build 197, i686-pc-mingw32) of 2023-01-07 built on HOME-C4E4A596F7 Repository revision: 9d410f8de64e91d16999a9bb5dd884d6d06d22bd Repository branch: emacs-29 Windowing system distributor 'Microsoft Corp.', version 5.1.2600 System Description: Microsoft Windows XP Service Pack 3 (v5.1.0.2600) Configured using: 'configure -C --prefix=/d/usr --with-wide-int --enable-checking=yes,glyphs 'CFLAGS=-O0 -gdwarf-4 -g3'' Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB Important settings: value of $LANG: ENU locale-coding-system: cp1255 Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr dabbrev emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cl-extra pp cl-print byte-opt gv bytecomp byte-compile help-fns radix-tree mule-util help-mode cl-loaddefs cl-lib apropos rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 54328 11479) (symbols 48 7273 0) (strings 16 20447 2422) (string-bytes 1 523245) (vectors 16 11853) (vector-slots 8 170903 17702) (floats 8 34 42) (intervals 40 449 141) (buffers 888 13)) From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 12 04:36:28 2023 Received: (at 60628) by debbugs.gnu.org; 12 Jan 2023 09:36:28 +0000 Received: from localhost ([127.0.0.1]:44701 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFu0a-00074v-3v for submit@debbugs.gnu.org; Thu, 12 Jan 2023 04:36:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFu0Y-00074i-CV for 60628@debbugs.gnu.org; Thu, 12 Jan 2023 04:36:26 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFu0S-0008Qn-Q8; Thu, 12 Jan 2023 04:36:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=rr5QnCYm2K9anTVxYPCyKkMXQqlJvbrqfkbHAHnfULQ=; b=oFzQE7VuEI3OMJVb+M2a Z4QSaxCkA4UbgQKy1OoGffg2nzYZXI0B2Mc+E9kUz6+E3/t2ws3pPduVJLooZtKUcuXlT7PB8Y2Jw hJVN4KT0qJvMHb86aUOtEApiQr1IYvPDJSRGeItn9vNPrHVajPiDT4zDElG3un7Ux48fJxv8Spqx/ Xnjzb43cDaWehEv40FJ0W7n7Yl1g+EGcTQk1dUfURqxC6WckY9lRDPqFVYbFIsLI28uJMRg1yq/yS 0Goo9X9qhyK5MdBvocRxfCK9zWfWeeLSblWfbz8X9kusjLtz+5HgRcQNVxSh34FlAlNiHv6tUCenO ddYllw3VDzS7TQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFu0F-0005uA-Rf; Thu, 12 Jan 2023 04:36:12 -0500 Date: Thu, 12 Jan 2023 11:36:42 +0200 Message-Id: <83bkn4ksb9.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: <83o7rascqg.fsf@gnu.org> (message from Eli Zaretskii on Sat, 07 Jan 2023 15:20:07 +0200) Subject: Re: bug#60628: 29.0.60; apropos-documentation does not work for preloaded symbols References: <83o7rascqg.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60628 Cc: 60628@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! > Date: Sat, 07 Jan 2023 15:20:07 +0200 > From: Eli Zaretskii > > To reproduce: > > emacs -Q > C-h d list.*directory RET > > Note that the resulting *Apropos* buffer only lists built-in functions > and variables, i.e. those defined in C. In particular, missing are > functions/variables from files.el, such as find-directory-functions, > parse-colon-path, and directory-files-recursively, whose doc strings > all match the regexp. > > This seems to be due to > > commit 59732a83c8875c8986d2221600d559a24d8309cc > Author: Stefan Monnier > Date: Thu Dec 30 23:17:45 2021 -0500 > > Don't store docstrings of preloaded .el files in etc/DOC > > The doc string of apropos-documentation does say: > > Note that by default this command only searches in the file specified by > ‘internal-doc-file-name’; i.e., the etc/DOC file. With C-u prefix, > or if ‘apropos-do-all’ is non-nil, it searches all currently 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. > > Moreover, "C-u C-h d" also doesn't work for preloaded functions, > because: > > (apropos-documentation-internal 'directory-files-recursively) > => nil > > This happens because: > > (apropos-safe-documentation 'directory-files-recursively) > => ("files.elc" . 39940) > > 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? Or else > why does it only look for "#@" comments preceded by a newline? > > Basically, apropos-documentation is currently completely broken on the > release branch. The following simple change seems to at least repair > "C-u C-h d", but I don't think it's sufficient, as we need to > resurrect the ability to find preloaded symbols without C-u. > > diff --git a/lisp/apropos.el b/lisp/apropos.el > index b260d88..cff6f1c 100644 > --- a/lisp/apropos.el > +++ b/lisp/apropos.el > @@ -1064,7 +1064,9 @@ apropos-documentation-check-elc-file > (setq apropos-files-scanned (cons file apropos-files-scanned)) > (erase-buffer) > (insert-file-contents file) > - (while (search-forward "\n#@" nil t) > + (while (search-forward "#@" nil t) > + (or (not (looking-at-p "[0-9]+")) > + (progn > ;; Read the comment length, and advance over it. > (setq end (read) > beg (1+ (point)) > @@ -1110,7 +1112,7 @@ apropos-documentation-check-elc-file > 'face apropos-match-face doc))) > (setcar (nthcdr (if this-is-a-variable 3 2) > apropos-item) > - doc)))))))))) > + doc)))))))))))) > > > Ideas? patches? comments? > > > > In GNU Emacs 29.0.60 (build 197, i686-pc-mingw32) of 2023-01-07 built on > HOME-C4E4A596F7 > Repository revision: 9d410f8de64e91d16999a9bb5dd884d6d06d22bd > Repository branch: emacs-29 > Windowing system distributor 'Microsoft Corp.', version 5.1.2600 > System Description: Microsoft Windows XP Service Pack 3 (v5.1.0.2600) > > Configured using: > 'configure -C --prefix=/d/usr --with-wide-int > --enable-checking=yes,glyphs 'CFLAGS=-O0 -gdwarf-4 -g3'' > > Configured features: > ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY > W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF > TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB > > Important settings: > value of $LANG: ENU > locale-coding-system: cp1255 > > Major mode: Lisp Interaction > > Minor modes in effect: > tooltip-mode: t > global-eldoc-mode: t > eldoc-mode: t > show-paren-mode: t > electric-indent-mode: t > mouse-wheel-mode: t > tool-bar-mode: t > menu-bar-mode: t > file-name-shadow-mode: t > global-font-lock-mode: t > font-lock-mode: t > blink-cursor-mode: t > line-number-mode: t > indent-tabs-mode: t > transient-mark-mode: t > auto-composition-mode: t > auto-encryption-mode: t > auto-compression-mode: t > > Load-path shadows: > None found. > > Features: > (shadow sort mail-extr dabbrev emacsbug message mailcap yank-media puny > dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg > rfc6068 epg-config gnus-util text-property-search time-date subr-x > mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils > mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr > mail-utils cl-extra pp cl-print byte-opt gv bytecomp byte-compile > help-fns radix-tree mule-util help-mode cl-loaddefs cl-lib apropos rmc > iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook > vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table > term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image > regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode > prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu > timer select scroll-bar mouse jit-lock font-lock syntax font-core > term/tty-colors frame minibuffer nadvice seq simple cl-generic > indonesian philippine cham georgian utf-8-lang misc-lang vietnamese > tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek > romanian slovak czech european ethiopic indian cyrillic chinese > composite emoji-zwj charscript charprop case-table epa-hook > jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs > theme-loaddefs faces cus-face macroexp files window text-properties > overlay sha1 md5 base64 format env code-pages mule custom widget keymap > hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty > make-network-process emacs) > > Memory information: > ((conses 16 54328 11479) > (symbols 48 7273 0) > (strings 16 20447 2422) > (string-bytes 1 523245) > (vectors 16 11853) > (vector-slots 8 170903 17702) > (floats 8 34 42) > (intervals 40 449 141) > (buffers 888 13)) > > > > From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 10:46:48 2023 Received: (at submit) by debbugs.gnu.org; 13 Jan 2023 15:46:48 +0000 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 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 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 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 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) 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== 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) From: Stefan Monnier To: Eli Zaretskii Subject: Re: 29.0.60; apropos-documentation does not work for preloaded symbols In-Reply-To: <83o7rascqg.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 07 Jan 2023 15:20:07 +0200") Message-ID: References: <83o7rascqg.fsf@gnu.org> Date: Fri, 13 Jan 2023 10:46:21 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.094 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: 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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > 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 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 15:10:12 2023 Received: (at submit) by debbugs.gnu.org; 13 Jan 2023 20:10:12 +0000 Received: from localhost ([127.0.0.1]:52485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGQNQ-0000rV-1o for submit@debbugs.gnu.org; Fri, 13 Jan 2023 15:10:12 -0500 Received: from lists.gnu.org ([209.51.188.17]:40796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGQNO-0000rL-7f for submit@debbugs.gnu.org; Fri, 13 Jan 2023 15:10:11 -0500 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 1pGQNN-0000xj-E0 for bug-gnu-emacs@gnu.org; Fri, 13 Jan 2023 15:10:10 -0500 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 1pGQNL-0000E0-CN; Fri, 13 Jan 2023 15:10:09 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2D3EB442967; Fri, 13 Jan 2023 15:10:05 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4452644295E; Fri, 13 Jan 2023 15:10:03 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1673640603; bh=galsRSiziPPv0AeNh2ZI7x8OXbHB0P0HrBA1Ub51cq4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=D9ViySSmZdkua/dv8Y5epZ3w621oMqHSEGNSN8bkxRE1Xmalq4kZHSd96zsDvNulx 41YnMBDyJMZF5+XtL1a/YvFrPvMCY2O6yASHi4ZJD3CosXjNkJPR2he1A4sVvrY0ds GsHq0j71oOP046Id7fCh4T8cRjjzThgLvbONawzTQAW8ITCqdNsvM+GMdG8fi161pg +JmPoX/VkYWG0aIh0jqVq6G4Utb3NNe8lGqWVWISlwg6sa3TiXknSvZL22P3C7PtXq p6Togv1+LFYVHw8iwyIXOJqB+2Wm64fJvfWdvpBKbP6YOs0gnCSZo7rEsOmQK0GaaT 6Oeqe0KGiQMKA== Received: from pastel (unknown [45.72.200.228]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1E475120E6B; Fri, 13 Jan 2023 15:10:03 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: 29.0.60; apropos-documentation does not work for preloaded symbols In-Reply-To: (Stefan Monnier's message of "Fri, 13 Jan 2023 10:46:21 -0500") Message-ID: References: <83o7rascqg.fsf@gnu.org> Date: Fri, 13 Jan 2023 15:10:02 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.221 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: 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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > For `emacs-29` the better option is probably to just revert the > above commit. Then again, since \n#@ can also match false positives, we may as well keep the above commit and just search for #@ instead. The patch below should fix both problems in a kind of "minimalist" way (i.e. meant for `emacs-29`). Can someone confirm it also works for them while I clean it up? Stefan diff --git a/lisp/apropos.el b/lisp/apropos.el index b260d889955..b66f27b8a9e 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -913,8 +913,19 @@ (apropos-sort-by-scores apropos-documentation-sort-by-scores) f v sf sv) (apropos-documentation-check-doc-file) - (if do-all - (mapatoms + (funcall + (if do-all #'mapatoms + (lambda (f) + (let ((preloaded-regexp + (concat "\\`" + (regexp-quote lisp-directory) + (regexp-opt preloaded-file-list) + "\\.elc?\\'"))) + (dolist (x load-history) + (when (string-match preloaded-regexp (car x)) + (dolist (def (cdr x)) + (when (eq 'defun (car-safe def)) + (funcall f (cdr def))))))))) (lambda (symbol) (setq f (apropos-safe-documentation symbol) v (get symbol 'variable-documentation)) @@ -939,7 +950,7 @@ (cons (list symbol (+ (apropos-score-symbol symbol 2) sf sv) f v) - apropos-accumulator))))))) + apropos-accumulator)))))) (apropos-print nil "\n----------------\n" nil t)))) @@ -1064,10 +1064,12 @@ (setq apropos-files-scanned (cons file apropos-files-scanned)) (erase-buffer) (insert-file-contents file) - (while (search-forward "\n#@" nil t) + (while (search-forward "#@" nil t) ;; Read the comment length, and advance over it. - (setq end (read) - beg (1+ (point)) + ;; This #@ may be a false positive, so don't get upset if + ;; it's not followed by the expected number of bytes to skip. + (when (and (setq end (ignore-errors (read))) (natnump end)) + (setq beg (1+ (point)) end (+ (point) end -1)) (forward-char) (if (save-restriction @@ -1110,7 +1112,7 @@ 'face apropos-match-face doc))) (setcar (nthcdr (if this-is-a-variable 3 2) apropos-item) - doc)))))))))) + doc))))))))))) From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 04:29:47 2023 Received: (at 60628) by debbugs.gnu.org; 14 Jan 2023 09:29:47 +0000 Received: from localhost ([127.0.0.1]:53382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGcrD-0005JT-7W for submit@debbugs.gnu.org; Sat, 14 Jan 2023 04:29:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45302) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGcrB-0005JD-5c for 60628@debbugs.gnu.org; Sat, 14 Jan 2023 04:29:45 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGcr0-0001Wv-I4; Sat, 14 Jan 2023 04:29:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=3pi+nVxWT87iB9uNi3ZwihwfYatOARe86Z4wsCFLP70=; b=LvrrYAqx77fc EeKl8wsAgQkMMDMctKkqTL7VPg9Z1v0zeUhiYfHl5iK49I/viyAooQHpZ+9HUFcSLojXDQEITV69B k+5M+4W6B8jQDBJozNm5NzGKmx8fxe75d7riegQo7tKDMQzfkri8nY/xB4ZcYUrp4RIf4abUYIRNX a68P5c3//zyErCMkEWX69awNlNYcYLpNKr9jEi1CQfQbs7vBGUdsg9n/9wtM3gsR7cyTafsfAgLSg pd8PVvmXwpPi6FUwEDUgFqKXsIM2hFCC56pktCbNNwQfsYGBzS7chIEwSqTnxPiM14EFsuarOjJzl cNcnMVxkmPZU+rL0/8VhwA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGcqu-0003cu-I8; Sat, 14 Jan 2023 04:29:31 -0500 Date: Sat, 14 Jan 2023 11:29:31 +0200 Message-Id: <837cxp8nwk.fsf@gnu.org> From: Eli Zaretskii To: Stefan Monnier In-Reply-To: (message from Stefan Monnier on Fri, 13 Jan 2023 15:10:02 -0500) Subject: Re: 29.0.60; apropos-documentation does not work for preloaded symbols References: <83o7rascqg.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60628 Cc: 60628@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: bug-gnu-emacs@gnu.org > Date: Fri, 13 Jan 2023 15:10:02 -0500 > > > For `emacs-29` the better option is probably to just revert the > > above commit. > > Then again, since \n#@ can also match false positives, we may as well > keep the above commit and just search for #@ instead. > > The patch below should fix both problems in a kind of "minimalist" way > (i.e. meant for `emacs-29`). > Can someone confirm it also works for them while I clean it up? It works much better, thanks. However, some symbols are still not shown, for some reason. For example, find-directory-functions and file-name-at-point-functions (both are defcustoms). I indeed don't see their doc strings in files.elc. Using "C-u C-h d" does produce an *Apropos* buffer with find-directory-functions in it, but file-name-at-point-functions are still not mentioned. I guess this is a separate issue, since Emacs 28 seems to have similar problems with those 2 defcustoms? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 09:27:49 2023 Received: (at 60628) by debbugs.gnu.org; 14 Jan 2023 14:27:49 +0000 Received: from localhost ([127.0.0.1]:53693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGhVc-0007Qt-S7 for submit@debbugs.gnu.org; Sat, 14 Jan 2023 09:27:49 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:45678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGhVZ-0007Qe-4s for 60628@debbugs.gnu.org; Sat, 14 Jan 2023 09:27:48 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A88E41000DD; Sat, 14 Jan 2023 09:27:38 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id CAADE1000CA; Sat, 14 Jan 2023 09:27:36 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1673706456; bh=oGHVUh0/2oYgPg2lktQvGvLZS2phwTr1U1mhwF4su+A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Y3LgGtVcWb5t0egEfAHo+rK/ysyy1RTPxNskbGX77rGZ8PGBDKehMXcWzKj2aic9u pfk4CacBkL12yu+SGJ7qXZ1iaipbPc2fyv/fFUaC9MgZSPI4Uf3b8jSml33USfgw9g 5JyLjXokS2SzivCgP6H1NWPtigr8WqMqUIMQEq1eMGDD8qUi7RnsUsX9CylX9V+iqK d0o0alJTLzyMhErygpqHgKEY3iComd18bnoKecL2u/4gtD3VFzbbCJItZLM+ZSOKNs c6Aw6GelMI9luxUJOqBw1oweUDid70XADp8eoX/oOrqD47O2Jwm0I+HY6gEd5WLbQw RUx8WfwshPpCg== Received: from pastel (unknown [45.72.200.228]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 88723120F2D; Sat, 14 Jan 2023 09:27:36 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: 29.0.60; apropos-documentation does not work for preloaded symbols In-Reply-To: <837cxp8nwk.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Jan 2023 11:29:31 +0200") Message-ID: References: <83o7rascqg.fsf@gnu.org> <837cxp8nwk.fsf@gnu.org> Date: Sat, 14 Jan 2023 09:27:34 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.323 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60628 Cc: 60628@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >> The patch below should fix both problems in a kind of "minimalist" way >> (i.e. meant for `emacs-29`). >> Can someone confirm it also works for them while I clean it up? > > It works much better, thanks. OK, thanks. I pushed a slightly better version of it to `emacs-29`. > However, some symbols are still not shown, for some reason. For > example, find-directory-functions and file-name-at-point-functions > (both are defcustoms). I indeed don't see their doc strings in > files.elc. Using "C-u C-h d" does produce an *Apropos* buffer with > find-directory-functions in it, but file-name-at-point-functions are > still not mentioned. I guess this is a separate issue, since Emacs 28 > seems to have similar problems with those 2 defcustoms? I pushed to master a rewrite of the .elc scanning code which may help (it wasn't its purpose, but it might be a side benefit). Stefan