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" <bug-gnu-emacs@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#67455: (Record source position, etc., in doc strings,
 and use this in *Help* and backtraces.)
Date: Mon, 03 Jun 2024 00:52:07 -0400
Message-ID: <jwvplsyodbh.fsf-monnier+emacs@gnu.org>
References: <Ze4IXIrh-WbZaTSu@ACM> <jwvzfv5iz4j.fsf-monnier+emacs@gnu.org>
 <ZgAIpy1Znle1IZiU@ACM> <jwvfrwefae8.fsf-monnier+emacs@gnu.org>
 <ZgHmmlpxP5S9set_@ACM> <jwv7chqdm51.fsf-monnier+emacs@gnu.org>
 <ZgKaAUMWzLXv6Alr@ACM> <jwvttks3hpj.fsf-monnier+emacs@gnu.org>
 <ZgPvE96-OisH-g8S@ACM> <jwvfrwb293o.fsf-monnier+emacs@gnu.org>
 <Zlx149bFwJm0zszQ@ACM>
Reply-To: Stefan Monnier <monnier@iro.umontreal.ca>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="40728"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cc: Eli Zaretskii <eliz@gnu.org>, 67455@debbugs.gnu.org
To: Alan Mackenzie <acm@muc.de>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 03 06:53:15 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1sDzh4-000AMB-Dt
	for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 Jun 2024 06:53:14 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1sDzgh-0007MP-RA; Mon, 03 Jun 2024 00:52:51 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1sDzgg-0007MD-EX
 for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 00:52:50 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1sDzgg-00038n-6g
 for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 00:52:50 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1sDzgs-0008Me-DO
 for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 00:53:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Stefan Monnier <monnier@iro.umontreal.ca>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Mon, 03 Jun 2024 04:53:02 +0000
Resent-Message-ID: <handler.67455.B67455.171739035632079@debbugs.gnu.org>
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.171739035632079
 (code B ref 67455); Mon, 03 Jun 2024 04:53:02 +0000
Original-Received: (at 67455) by debbugs.gnu.org; 3 Jun 2024 04:52:36 +0000
Original-Received: from localhost ([127.0.0.1]:42767 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1sDzgR-0008LJ-Oa
 for submit@debbugs.gnu.org; Mon, 03 Jun 2024 00:52:36 -0400
Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46165)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@iro.umontreal.ca>) id 1sDzgO-0008Kr-QI
 for 67455@debbugs.gnu.org; Mon, 03 Jun 2024 00:52:33 -0400
Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 07ED4802B6;
 Mon,  3 Jun 2024 00:52:14 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1717390328;
 bh=SUcHmtNk7dpkLji6CgWgRa8b+FIeNnvV0QwTgNWis4M=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=Hw+o91pD7QT8c7P5kFzgIm3RDo1jhQZd0iWioG2SYeS+PTPhRA4OPWCVKP9BMHKKS
 MDOahMnF8UAvzHRBorRV7J5FlG7fAddmu1+RdUrppELgbjPb9ZmPtYK9+O9yjSuLze
 JbQI5Gac0P/dZL833qPEnlsBgx8+I9KHR+r/oPTmRDkW/R1+zrjmARiY67z9aCZxDt
 RPpLr3LuU21bLDHKzBKzX5KK5mAZQB/UIO2IzdYQl2gKlX0W0Oz1cqt0IJ4FHii7rK
 4Xk6VXTL72BfuFgb04DguYOccJoD53/7MrubqUZxmQzuCR6+JEgWXYE29Hrx+vSnK7
 zPzHFONyzLXQQ==
Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A80F5805DE;
 Mon,  3 Jun 2024 00:52:08 -0400 (EDT)
Original-Received: from pastel (unknown [24.140.236.196])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 780E91201B6;
 Mon,  3 Jun 2024 00:52:08 -0400 (EDT)
In-Reply-To: <Zlx149bFwJm0zszQ@ACM> (Alan Mackenzie's message of "Sun, 2 Jun
 2024 13:38:43 +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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=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:286412
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/286412>

> The solution now seems obvious: In loadup.el, we should load
> backquote.el before byte-run.el, and rewrite all our hand expanded
> backquotes in byte-run.el (including in byte-run--posify-defining-form)
> as actual backquote forms.
>
> backquote.el doesn't actually need anything in byte-run.el bar the macro
> defun itself.  It would be a simple job to replace each (defun
> backquote-foo ...) in the file with (defalias 'backquote-foo #'(lambda
> ....)).

Well, it uses both `defun` and `defmacro`.
But rather than hand-expand them, we might be able to get the same
result by prepending some minimal definitions of those two, as in:

    (if (fboundp 'defun) nil
      ;; This file is loaded before `byte-run.el' so when loading the .el
      ;; file, defun/defmacro may not be defined yet, so we provide
      ;; some minimalist fallback replacement.
      (fset 'defmacro
            (cons 'macro
                  #'(lambda (name args &rest body)
                      (list 'defalias (list 'quote name)
                            (list 'cons ''macro
                                  (list 'function
                                        (cons 'lambda (cons args body))))))))
      (defmacro defun (name args &rest body)
        (list 'defalias (list 'quote name)
              (list 'function (cons 'lambda (cons args body))))))

These would be used only at the beginning of the bootstrap and thus
shouldn't affect the final `src/emacs`.


        Stefan