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: Sat, 09 Mar 2024 16:36:57 -0500 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="39313"; 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 Sat Mar 09 22:37:50 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 1rj4O6-000A4S-5p for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Mar 2024 22:37:50 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rj4Nn-00032R-IL; Sat, 09 Mar 2024 16:37:31 -0500 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 1rj4Nl-000325-Ic for bug-gnu-emacs@gnu.org; Sat, 09 Mar 2024 16:37:29 -0500 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 1rj4Nl-0005aQ-8v for bug-gnu-emacs@gnu.org; Sat, 09 Mar 2024 16:37:29 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rj4OI-0002ju-2U for bug-gnu-emacs@gnu.org; Sat, 09 Mar 2024 16:38:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Mar 2024 21:38: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.171002027110513 (code B ref 67455); Sat, 09 Mar 2024 21:38:02 +0000 Original-Received: (at 67455) by debbugs.gnu.org; 9 Mar 2024 21:37:51 +0000 Original-Received: from localhost ([127.0.0.1]:34925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rj4O7-0002jV-55 for submit@debbugs.gnu.org; Sat, 09 Mar 2024 16:37:51 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:40630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rj4O3-0002jH-ND for 67455@debbugs.gnu.org; Sat, 09 Mar 2024 16:37:49 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D6467100170; Sat, 9 Mar 2024 16:37:05 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1710020223; bh=aVEYQlb5wgJGI2359fAdvjT0E2hrKhLaZepwmW8GXC4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=OtrF/o4X0z0Uc4ScRhWDusMuRTKi/TQqe1NvvXcRFlzN+/M6UNw+1RhH9rgJfDlpK 2fm4jZ/gU+GgR2ISSRvmSGJpNP2sORJ37FsyI+O/nvpDHYKMvcsCYILfHilsG0J9SG Wiuw/hCXswy6gFF7lONvKEyUSNgXNNRvKcAvRguiVoKK8jotpG+xZfQaQi3u/4KW/G PypHCCdz56p6t/UMTP6amlI1/2FUaYofx/P19mk8P/e2xt0PE8z9m9Bu9V/Z3fqXDx dFVCjKEQz+9j7nx7gyI172cKvdAwsaH3sz4tNj/MR1COjDE6ArXKjGe+Pmn4W3PmhJ D8w9H7mNB9M6w== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 83CB310005D; Sat, 9 Mar 2024 16:37:03 -0500 (EST) Original-Received: from pastel (unknown [69.165.147.56]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3BA8212059D; Sat, 9 Mar 2024 16:37:03 -0500 (EST) In-Reply-To: (Alan Mackenzie's message of "Mon, 4 Mar 2024 15:38:14 +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:281356 Archived-At: > I've just pushed a large commit to feature/positioned-lambdas, a work > in progress commit for bug#67455, putting source position information at > the start of doc strings. master was merged into it just before the > commit. I barely started to look at the code, but regarding the following hunk: diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el index 6917128d70a..0d4681bc979 100644 --- a/lisp/emacs-lisp/backquote.el +++ b/lisp/emacs-lisp/backquote.el @@ -172,6 +172,30 @@ backquote-process (backquote-delay-process s (1- level)))) ((eq (car s) backquote-backquote-symbol) (backquote-delay-process s (1+ level))) + ;; Process a (lambda ...) form specially, since otherwise the + ;; lambda symbol would get separated from its introductory (, + ;; preventing this processing from being done elsewhere in macro + ;; expansion. + ((and (eq (car s) 'lambda) + (symbol-with-pos-p (car s)) + (listp (car-safe (cdr s)))) + (let ((kdr (backquote-process (cdr s) level)) + (lambda-pos (symbol-with-pos-pos (car s))) + ) + (if (null byte-compile-in-progress) + (setcar s 'lambda)) ; Strip the position. + (cond + ((= (car kdr) 0) + (cons (car kdr) + (list 'quote + (byte-run-posify-lambda-form + (cons (car s) (car (cdr (cdr kdr)))) ; Two cdr's to strip 'quote. + lambda-pos)))) + (t + (cons 1 + (list 'byte-run-posify-lambda-form + (list 'cons (list 'quote (car s)) (cdr kdr)) + lambda-pos)))))) (t (let ((rest s) item firstlist list lists expression) - Testing `byte-compile-in-progress` can't be right. Do you to test whether the result of this backquote will be byte-compiled or do you really mean to test whether this backquote happens to be executed during compilation (which could be because the compiler ends up loading code while executing `eval-when-compile` or `require`)? - My gut tells me that changing backquote can't be right. (lambda (f) ..) *can* appear within a backquote without it being an actual lambda expression. What alternatives have you considered? Stefan