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: Sun, 10 Mar 2024 20:50: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="5081"; 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 Mon Mar 11 01:50:52 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 1rjTsS-0001AU-GQ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Mar 2024 01:50:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjTs7-0005Px-QS; Sun, 10 Mar 2024 20:50:33 -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 1rjTs5-0005OB-GE for bug-gnu-emacs@gnu.org; Sun, 10 Mar 2024 20:50:29 -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 1rjTs5-0007z1-7z for bug-gnu-emacs@gnu.org; Sun, 10 Mar 2024 20:50:29 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rjTsc-0002JO-Dv for bug-gnu-emacs@gnu.org; Sun, 10 Mar 2024 20:51: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: Mon, 11 Mar 2024 00:51: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.17101182578875 (code B ref 67455); Mon, 11 Mar 2024 00:51:02 +0000 Original-Received: (at 67455) by debbugs.gnu.org; 11 Mar 2024 00:50:57 +0000 Original-Received: from localhost ([127.0.0.1]:38174 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rjTsW-0002J5-Ky for submit@debbugs.gnu.org; Sun, 10 Mar 2024 20:50:56 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:61671) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rjTsU-0002Ir-9J for 67455@debbugs.gnu.org; Sun, 10 Mar 2024 20:50:54 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id B864F80DB3; Sun, 10 Mar 2024 20:50:12 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1710118209; bh=xwtbAD3fOXPEvUvxvr5fMw3/0Myj9OEpYiwK+QeJh+s=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=LB289A7NV8ARORqJn/eJNbdpKCR1thKUJqKymLPKEvMYL1m7woKyUcOTTPgGbxn0v 3eVoLyYuH32j1MyssxmgzNMF4iLNmQIqjyf7EzuzFEv1i7yD2lUr7ia2/mYXAgc2s0 yu8iF93gVusU+1MkFmd6zicp0u1IsTHgkAPoDZ55vdaIzyUK3yRG/gTTUvfWbUnnqH lfAdUuHTXAi5tdfc8CkSZXmCcw4itZnhO2f2zPWiaY2+XJEHRcy1FmIT3Eqxa10sOt Q11XqXU8PSpz/7MPdlQKNc75c3FioDrtLMfBjyv67A4O4PD0Wm0JO3uZv1/lgohvv5 Vz16x4fFeEebg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5A77C8093D; Sun, 10 Mar 2024 20:50:09 -0400 (EDT) Original-Received: from alfajor (69-165-147-56.dsl.teksavvy.com [69.165.147.56]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2D967120403; Sun, 10 Mar 2024 20:50:09 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Sun, 10 Mar 2024 22:27:29 +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:281446 Archived-At: >> 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... Stefan