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: Wed, 13 Mar 2024 10:54:54 +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="38154"; 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 Wed Mar 13 11:55:55 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 1rkMH3-0009jN-EF for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Mar 2024 11:55:53 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rkMGm-0005Cw-LM; Wed, 13 Mar 2024 06:55:37 -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 1rkMGg-0005BP-Er for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2024 06:55:30 -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 1rkMGd-0007BC-SF for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2024 06:55:29 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rkMHC-0004zy-BF for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2024 06:56: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: Wed, 13 Mar 2024 10:56: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.171032734319185 (code B ref 67455); Wed, 13 Mar 2024 10:56:02 +0000 Original-Received: (at 67455) by debbugs.gnu.org; 13 Mar 2024 10:55:43 +0000 Original-Received: from localhost ([127.0.0.1]:44766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkMGt-0004zM-0u for submit@debbugs.gnu.org; Wed, 13 Mar 2024 06:55:43 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:52450) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkMGn-0004yr-1y for 67455@debbugs.gnu.org; Wed, 13 Mar 2024 06:55:40 -0400 Original-Received: (qmail 36486 invoked by uid 3782); 13 Mar 2024 11:54:55 +0100 Original-Received: from acm.muc.de (p4fe15744.dip0.t-ipconnect.de [79.225.87.68]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 13 Mar 2024 11:54:54 +0100 Original-Received: (qmail 9203 invoked by uid 1000); 13 Mar 2024 10:54:54 -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:281544 Archived-At: Hello, Stefan. On Sun, Mar 10, 2024 at 20:50:05 -0400, Stefan Monnier wrote: > >> No matter how many extra tests you add to reduce the frequency, you're > >> fundamentally adding a bug :-( > > Well, macroexp--expand-all has treated (function (lambda ...)) as a > > function long before I started on this project in November. > Of course it does, and that's correct, because by definition the > argument to `macroexp--expand-all` must be source code expression. > > Would trusting the same thing in backquote-process be any > > more dangerous? > Yup, because backquote has no guarantee that the code it must produce is > one that will build a source code expression. > > How about adding (an) extra arm(s) to the large pcase in > > macroexp--expand-all which would recognise backquote's output for > > "evaluated" lambdas. > > What we get back from backquote looks like: > > (cons 'lambda (cons plain-args body)) or > > (list 'lambda args)) or maybe one or two other forms. > Same problem: > (cons 'lambda (cons plain-args body)) > constructs something that may look like a function but that may not be > intended to be used as a function. All we know is that it should build > a list with a `lambda` symbol in it. > It's only when the result of the execution of this code is passed to > `macroexp--expand-all` that we discover that it was meant to build > a list that represents the source code of a function; and only at *that* > point are we allowed to modify that list by macro-expanding expressions > in its body, modifying its docstring, byte-compiling, etc... OK, so it seems like I'll need a new pcase arm in macroexp--expand-all, and this new code will need to handle (function (cons 'lambda ...)), and the like. I'll not actually be able to do too much in the next few days, though. > Stefan -- Alan Mackenzie (Nuremberg, Germany).