From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#67455: Record source position, etc., in doc strings, and use this in *Help* and backtraces. Date: Mon, 4 Dec 2023 17:36:36 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33465"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Stefan Monnier To: 67455@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 04 18:37:12 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 1rACsZ-0008Wc-N8 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Dec 2023 18:37:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rACsI-0002gK-Gk; Mon, 04 Dec 2023 12:36:54 -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 1rACsF-0002d4-Sz for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 12:36:51 -0500 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 1rACsF-0000mR-KY for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 12:36:51 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rACsQ-00059V-7S for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 12:37:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Dec 2023 17:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67455 X-GNU-PR-Package: emacs Original-Received: via spool by 67455-submit@debbugs.gnu.org id=B67455.170171141619793 (code B ref 67455); Mon, 04 Dec 2023 17:37:02 +0000 Original-Received: (at 67455) by debbugs.gnu.org; 4 Dec 2023 17:36:56 +0000 Original-Received: from localhost ([127.0.0.1]:35596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rACsK-00059A-44 for submit@debbugs.gnu.org; Mon, 04 Dec 2023 12:36:56 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:15852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rACsH-00058y-Vt for 67455@debbugs.gnu.org; Mon, 04 Dec 2023 12:36:54 -0500 Original-Received: (qmail 53292 invoked by uid 3782); 4 Dec 2023 18:36:37 +0100 Original-Received: from acm.muc.de (pd953aae0.dip0.t-ipconnect.de [217.83.170.224]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 04 Dec 2023 18:36:36 +0100 Original-Received: (qmail 21416 invoked by uid 1000); 4 Dec 2023 17:36:36 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:275519 Archived-At: Hello, Stefan and Eli. On Sun, Nov 26, 2023 at 14:30:25 +0000, Alan Mackenzie wrote: > Hello, Emacs. > The reasons for this bug and the ways to solve it have been discussed > extensively in the thread for bug#66750. > We will, in functions' and macros' doc strings record the file name and > position of the source code, and possibly other items, in a machine > parseable format (which has yet to be decided). > This is particularly intended for lambda functions, which currently > appear in backtraces and *Help* buffers with insufficient information to > identify them. These displays will be enhanced to identify these lambda > functions satisfactorally. > The functions in Emacs which currently use doc strings will be modified > so as not to be negatively affected by the new information written into > them. I've committed the first stage of this implementation in the new git branch feature/positioned-lambdas. It creates for compiled functions (but not yet for interpreted ones) doc strings starting with a specially formatted string containing the defining symbol, the source file name, the position of the defining symbol in the file, and the position of the lambda (should we be in one) in the file. To instruct a defining macro to set a defining-symbol, it is only necessary to add a clause like (defining-symbol 1) or (defining-symbol (if (consp struct) (car struct) struct)) to the macro's declare form. This is how defun now works. (Thank you Stefan for the handy "cl.el feature" in byte-run--parse-declarations. ;-) I scanned our Lisp code for debug-spec &define keywords, and added defining-symbol declare clauses to (most of) the ones I found. As yet, no use is made of the new position information (beyond stripping it off for other uses of the doc string). > -- > Alan Mackenzie (Nuremberg, Germany).