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: Tue, 26 Mar 2024 20:21:50 +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="18441"; 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 Tue Mar 26 21:23:23 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 1rpDKM-0004aj-U7 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Mar 2024 21:23:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpDK4-0005P6-Ni; Tue, 26 Mar 2024 16:23:04 -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 1rpDK3-0005Ol-3K for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 16:23:03 -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 1rpDK2-0001ZO-Qk for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 16:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rpDK2-0005Lk-8R for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 16:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Mar 2024 20:23: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.171148452220369 (code B ref 67455); Tue, 26 Mar 2024 20:23:02 +0000 Original-Received: (at 67455) by debbugs.gnu.org; 26 Mar 2024 20:22:02 +0000 Original-Received: from localhost ([127.0.0.1]:35153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpDJ3-0005IQ-HC for submit@debbugs.gnu.org; Tue, 26 Mar 2024 16:22:01 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:10280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpDIz-0005Ho-M2 for 67455@debbugs.gnu.org; Tue, 26 Mar 2024 16:22:00 -0400 Original-Received: (qmail 15113 invoked by uid 3782); 26 Mar 2024 21:21:51 +0100 Original-Received: from acm.muc.de (p4fe15213.dip0.t-ipconnect.de [79.225.82.19]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 26 Mar 2024 21:21:51 +0100 Original-Received: (qmail 16027 invoked by uid 1000); 26 Mar 2024 20:21:50 -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:282111 Archived-At: Hello, Stefan. On Tue, Mar 26, 2024 at 15:40:05 -0400, Stefan Monnier wrote: > >> >> > Sorry about that. A quick summary: defined symbols (and lambda) get > >> >> > positioned by the new reader function read-positioning-defined symbols. > >> >> > The new declare clause defining-symbol marks a macro such as defun or > >> >> > cl-defgeneric as a macro which defines such symbols. > >> Since I still don't understand the general picture, let me tell you how > >> I would plan to do it, so you can tell me where it matches your > >> approach and where it doesn't: > >> - Change `load-source-file-function` so it uses > >> `read-positioning-symbols` instead of plain `read`. > >> [ This means that macro-expansion will now almost always have sympos, > >> rather than only during compilation, ] > > load-source-file-function is set to read-positioning-defined-symbols. > [ I see it's `load-read-function`. ] Yes! > How does this differ from `read-positioning-symbols` and why do we need > it to be different? r-p-defined-s positions only lambdas and NAMEs defined by defun, defmacro, defvar, .... (around 50 defining symbols). r-p-s positions every symbol apart from nil. They have different purposes. r-p-d-s gets info for the doc strings, which requires SWPs only for some symbols. r-p-s is needed to get warning message locations. Were r-p-s used for the doc string position information, most of the symbols would need to be stripped of their positions before the form could be used. It is simpler and faster not to position them at all. > > (In a change to be committed, it gets bound to this function in Fload). > > In reading > > (defun foo () "foo doc" (lambda (bar) "lambda doc" (car bar))) > > , foo gets positioned (because it follows defun), and so does lambda > > (because it is a lambda following "("). > IIUC "gets positioned" means that it is a symbol-with-pos rather than > a bare symbol? Yes. > > I'm not entirely sure, but I think in non-eager macro expansion the > > position information in SWPs is typically available. > In lazy macro-expansion, SWPs are not available, no. > But that's OK, it's rare and there's very little we can do about it (the > reason it's lazy is indeed because we only discover very late that those > sexps were meant to represent code. It's typically when a sexp is > passed to `eval`). OK. > Stefan -- Alan Mackenzie (Nuremberg, Germany).