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#67455: (Record source position, etc., in doc strings, and use this in *Help* and backtraces.) Date: Tue, 26 Mar 2024 15:40:05 -0400 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5444"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 67455@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 26 20:41:29 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 1rpCfo-0001DS-J6 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Mar 2024 20:41:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rpCfR-0005OU-7k; Tue, 26 Mar 2024 15:41:05 -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 1rpCfQ-0005OL-4K for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 15:41:04 -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 1rpCfP-0007Dh-Td for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 15:41:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rpCfP-0002zR-68 for bug-gnu-emacs@gnu.org; Tue, 26 Mar 2024 15:41:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Mar 2024 19:41:03 +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.171148201911327 (code B ref 67455); Tue, 26 Mar 2024 19:41:03 +0000 Original-Received: (at 67455) by debbugs.gnu.org; 26 Mar 2024 19:40:19 +0000 Original-Received: from localhost ([127.0.0.1]:35098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpCeg-0002wd-OV for submit@debbugs.gnu.org; Tue, 26 Mar 2024 15:40:19 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:1398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rpCeb-0002wN-9q for 67455@debbugs.gnu.org; Tue, 26 Mar 2024 15:40:17 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id DF16110004C; Tue, 26 Mar 2024 15:40:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1711482006; bh=pYJpCt17/vhcX0aXUShCNIosVkff3c3GbfbX/OX4Q1M=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fnPLLyRAxoOIfbNF23Uw4nAeJftdEfRRPR16lGMjH3DgJuwB9Mkp4DUv7IRf9wSdB laFZDcdBNuQU2o5ieg581X7dURDoLTRd8OGG5mXkO7icDEhDADG7+dCN5q4TKuMVU8 XQN18wvdDK5HSbJRm3fQ7DFm+KhIaCeVZZpyWlReSgUY3/xVNZvlwVnFk021BXY+hm avAGiOKc3Tnc0nNxwVFScEQLX7s8j3GVMwpqL+esJ2ZGSj8J5l0ywUIIV/3yXCrRjH Ku2FdWNaUdBmakWDwJCLFDgoXJlh1chehWNzs5cE1MjzrEIhHs4G9OuLYduV6rbbY6 ts5dVpJK3Xi+w== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E2451100046; Tue, 26 Mar 2024 15:40:06 -0400 (EDT) Original-Received: from pastel (unknown [45.72.199.112]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BB78112082A; Tue, 26 Mar 2024 15:40:06 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Tue, 26 Mar 2024 16:55:16 +0000") 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:282109 Archived-At: >> >> > 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`. ] How does this differ from `read-positioning-symbols` and why do we need it to be different? > (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? > 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`). Stefan