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, 19 Mar 2024 18:32:54 -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="25053"; 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 19 23:33:39 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 1rmi1a-0006HG-Gq for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Mar 2024 23:33:38 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmi1M-0007KF-Eb; Tue, 19 Mar 2024 18:33:24 -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 1rmi1L-0007K7-9n for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2024 18:33:23 -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 1rmi1L-000617-1e for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2024 18:33:23 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rmi1x-0007hb-Vv for bug-gnu-emacs@gnu.org; Tue, 19 Mar 2024 18:34:02 -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, 19 Mar 2024 22:34: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.171088762529567 (code B ref 67455); Tue, 19 Mar 2024 22:34:01 +0000 Original-Received: (at 67455) by debbugs.gnu.org; 19 Mar 2024 22:33:45 +0000 Original-Received: from localhost ([127.0.0.1]:37539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rmi1g-0007gp-VC for submit@debbugs.gnu.org; Tue, 19 Mar 2024 18:33:45 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:18402) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rmi1f-0007gU-C3 for 67455@debbugs.gnu.org; Tue, 19 Mar 2024 18:33:43 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 24D4980D32; Tue, 19 Mar 2024 18:32:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1710887576; bh=JmHFr4I9ATc1wNrvtH6Nc5vz3QL3TEof+ZN2dZA4u4U=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=GgpHUFOT6SW7V7mRkIOjuGIApIKvC+YRKf2W4FNpGoLv2CCwxw1XRB5SHVDioW0eI o8Ujgjy8HvN+YM1CBJQ0k0lNzyhT0Nq1jwKGVjnZFunDDxNFi7YKjWGmUVyVBW1AOl YoXbxbnohjPONKEej1S6l3F+NPrs7lj2lXgCCfzwozXfjDYcu9iilQ3oppS/Q2HjSI iu0m21FcUPKsJ07mmqyMyEthsvAXnZ5eZUQQBk75Kor67/6S1fnC194+NLmIFOhajx 1h/AdIcPxODoN7qWKompxYvdJW6uZvIBTfpFBzkvg+jYYozipDtLb9d+fTNQeRItSr AXhiBcmvFelAw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E037A803C1; Tue, 19 Mar 2024 18:32:56 -0400 (EDT) Original-Received: from pastel (unknown [104.247.238.200]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B952612072D; Tue, 19 Mar 2024 18:32:56 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Tue, 19 Mar 2024 21:40:12 +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:281845 Archived-At: > When Lisp gets read for interpretation, defined symbols (e.g. folliowing > defun or cl-defgneric) get positioned, as do lambdas. I don't know what that means. > When there are ,s or ,@s on the arg list or the doc string of the > lambda, the lambda currently gets posified by the new code in > backquote-process. Are you talking about "lambda" as in "the symbol" or as in "a (lambda ...) expression". If it's "the symbol", then I can't see where a , or ,@ can appear. If the other, then if there's a , or ,@ in there it presumably means we don't yet know whether it *will* be a lambda-expression or just a list with a lambda symbol: at that point, it's just data and we don't know if it will be used to build code. > Without the new code, the "complicated" lambdas retain their > positions, which cause errors in pdump, which doesn't (and shouldn't) > handle SWPs. So, IIUC, your "get positioned" above means you preserve/add (rather than strip) the position info on some symbols, most notably those `lambda`s which "you" predict will be used for code, and if your prediction is wrong then those sympos end up escaping into the wild. > You're right about my sketched approach not working if the programmer > uses cons/list instead of `, ,, and ,@. (Thanks!) Maybe I can somehow > wait until (cons 'lambda (cons args body)) has been evaluated in ME2, > before posifying the lambda. And also take the change out of > backquote-process. Sounds about right. You'll lose information about the place where the `lambda` symbol was found in the code, but it's hard to do much better with what we have, We could introduce a new `backquote-lisp-form` which works just like backquote but which additionally asserts that what it builds will be used as a Lisp form rather than as data. BTW, we already have such a thing under the name "edebug-\`". > With this idea, most of the new code would go into the (`(function ,(and > f `(lambda ,_ . ,_))) ...) pcase arm of macrexp--expand-all, with > possibly a new arm to catch and "neutralise" the remaining lambdas, which > aren't functions. Not sure what other lambdas you're thinking of. Stefan