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 21:32:19 +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="11477"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, Eli Zaretskii , 67455@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 04 22:33:03 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 1rAGYp-0002od-9V for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Dec 2023 22:33:03 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rAGYf-0005co-Gw; Mon, 04 Dec 2023 16:32:53 -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 1rAGYd-0005cK-G0 for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 16:32: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 1rAGYd-00022S-3m for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 16:32:51 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rAGYn-0005uG-M0 for bug-gnu-emacs@gnu.org; Mon, 04 Dec 2023 16:33:01 -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 21:33:01 +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.170172556022678 (code B ref 67455); Mon, 04 Dec 2023 21:33:01 +0000 Original-Received: (at 67455) by debbugs.gnu.org; 4 Dec 2023 21:32:40 +0000 Original-Received: from localhost ([127.0.0.1]:35933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rAGYR-0005th-JJ for submit@debbugs.gnu.org; Mon, 04 Dec 2023 16:32:39 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:22632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rAGYP-0005tS-JQ for 67455@debbugs.gnu.org; Mon, 04 Dec 2023 16:32:38 -0500 Original-Received: (qmail 23399 invoked by uid 3782); 4 Dec 2023 22:32:20 +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 22:32:20 +0100 Original-Received: (qmail 13521 invoked by uid 1000); 4 Dec 2023 21:32:19 -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:275539 Archived-At: Hello, Stefan. Thanks for such a quick response. On Mon, Dec 04, 2023 at 13:33:25 -0500, Stefan Monnier wrote: > > I've committed the first stage of this implementation in the new git > > branch feature/positioned-lambdas. > Haven't had enough time to look closely, so just some quick early comment. > > 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, > Why include the file name? Presumably we will rely on a `(FILE . POS)` > to find that docstring so including FILE in there is rather redundant > (and in addition to that, this file name can be wrong if it's absolute > since files often get moved between compilation and use). No, the (FILE . POS) is the .elc file, the one I'm putting into the new info is the source file. But you're right about an absolute name (as it currently is) not being the Right Thing. A lot of Emacs users will be using binaries compiled by somebody else on a different machine, so an absolute name is unhelpful, as well as divulging information about the builder's file structure. Maybe it should be lisp/emacs-lisp/bytecomp.el rather than /home/acm/emacs/emacs.git/sub-master-a/lisp/emacs-lisp/bytecomp.el. At least it would be shorter. > > the position of the defining symbol in the file, and the position of > > the lambda (should we be in one) in the file. > Why two positions? > Why not use the same position info as used in `byte-compile-warn-x`? I'm not sure, yet, but I suspect both positions will be useful. If not, it's trivial to change the contents of the new info, at least it is now. > > To instruct a defining macro to set a defining-symbol, it is only > > necessary to add a clause like (defining-symbol 1) > Sounds good. > [ Hopefully we can eventually use that info for `font-lock` so we can > get rid of ad-hoc rules for `defun` and friends. It would require an > additional piece of info (not only the position but also the kind of > definition, to distinguish `defun` from `defvar`). ] > > or (defining-symbol (if (consp struct) (car struct) struct)) > [ Haven't seen that yet. ] Have a look at cl-defgeneric and cl-defmethod in cl-generic.el. > Stefan -- Alan Mackenzie (Nuremberg, Germany).