GNU bug report logs - #77557
master: macroexp--expand-all mismatches on (name (c-defun-name)).

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Alan Mackenzie <acm@HIDDEN>; dated Sat, 5 Apr 2025 18:42:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 77557 <at> debbugs.gnu.org:


Received: (at 77557) by debbugs.gnu.org; 5 Apr 2025 18:51:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 05 14:51:06 2025
Received: from localhost ([127.0.0.1]:44795 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u18bh-0008Gu-EW
	for submit <at> debbugs.gnu.org; Sat, 05 Apr 2025 14:51:06 -0400
Received: from mail-vk1-xa2c.google.com ([2607:f8b0:4864:20::a2c]:57761)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <shipmints@HIDDEN>)
 id 1u18be-0008GL-2R
 for 77557 <at> debbugs.gnu.org; Sat, 05 Apr 2025 14:51:02 -0400
Received: by mail-vk1-xa2c.google.com with SMTP id
 71dfb90a1353d-52410fb2afeso2631734e0c.3
 for <77557 <at> debbugs.gnu.org>; Sat, 05 Apr 2025 11:51:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1743879056; x=1744483856; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=olOkjwWvY/2QkM7B28e2F1ycrpJm2k5+7QvJnbCRiIk=;
 b=SdRKcXXnSsmqd+sQKZr3hboSFsoklzaKBkZWVUg5a9DRaDhNXnVxeltWQFp/Y66uTy
 hZ3lHdti88wYsZdmJioZEkbxzM2PwLYgtdyecA/23WsnclNrFqs3svx7wB19C7DLB1+A
 SRRrnTaKAWlIm0WoSSZBHTSO1Vw8Tecc6b8bgTu0HVf3E7tKV0OzchhKJMZQofpJiS1V
 +aiBVn50Gtq7kRkxalVbnxcodVgo8ESXtrCn9Godq6Qfg61hyMYb5IJ3vCio85eeuMvM
 yAtifTrUc6KW2b/OgMBfeenAcQX7gFg2qg/gGJN1/fqgEj3mzeqk9uinId5NLHnITiDD
 DT6Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1743879056; x=1744483856;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=olOkjwWvY/2QkM7B28e2F1ycrpJm2k5+7QvJnbCRiIk=;
 b=j/LZuItgljmVGO7LDnv6gy2+uRPGtMbLYw26QBFSanMYCFk9UUbe3TNLmO3S3PEgMK
 0VFNhnuqA52Jrc1yBgfNO1CNisB/s0r1/4Ynq9LfkB4DSzeMr1U18UAj/2vWKY/Xb3zP
 LJF0bAtkMllArqjIJ+xCCZxGdchDMb+gXsYQRY6rP3gGWU+Mkn2DppzGpx4Pf28xIzC6
 z5vka4nQs7a5FDcxhjEqE7NsEBRRiIaWuhj3vWcucGpwo7r/nVrpiXff++cSJHqNCVL3
 3el0F65nhMObBCf7UPu40+bzDkIKciqx58nrULsT9zowSLIMO0pJpAqjmdw2cdQapBuD
 9CVA==
X-Gm-Message-State: AOJu0YxmOjza74kt2r0QAyI66nY1f3PWWBmlZ/qwCZZMgqiwFrlFtfX9
 mhprY0iMmoMOAN0w44+QSBGqxHmxvmXv6twcgnlZOvyQKjskGrdDhnT72O5WH86MbVod7npeqLy
 q/8bk5RpRE7C4cmB0vN8d0VaynqQ=
X-Gm-Gg: ASbGnct0+Z5j4oYyO6nSaGB/tEGtGNy/mDiZ++JvmSWCOJ7Rio9xaEq8vfweEhEf0S3
 f+M+DNtcqlS2EH3J6iPH/N85+97+LVKcJNtSV2CNWqQHHksAIHm0EZxiNJyybFnKqlzOYwJkxdo
 hpPX33U8rap2HQynjMjcdo9eovJQ==
X-Google-Smtp-Source: AGHT+IFxp+1GoZRC3tEKHA7R6NVaap8rIwWhXgCfp0jTFQaOIX7JoZH+oWv2DDNdX61Ja4JG0sgXTX+WRULlbRK9lhA=
X-Received: by 2002:a05:6102:570b:b0:4bb:9b46:3f92 with SMTP id
 ada2fe7eead31-4c8568a6d24mr5376294137.1.1743879056249; Sat, 05 Apr 2025
 11:50:56 -0700 (PDT)
MIME-Version: 1.0
References: <Z_F5PKh1y9IrJHdN@HIDDEN>
In-Reply-To: <Z_F5PKh1y9IrJHdN@HIDDEN>
From: Ship Mints <shipmints@HIDDEN>
Date: Sat, 5 Apr 2025 14:50:45 -0400
X-Gm-Features: ATxdqUEVdnhS_6f-EmXQWm3kMti6RsGfkEkD-YY34gZHdKj8tMgZYadCtOX4v5Y
Message-ID: <CAN+1HbpWvXbK2GEc+ovgBwidAu7XnsoU_VroRq8eTaavSnaP9A@HIDDEN>
Subject: Re: bug#77557: master: macroexp--expand-all mismatches on (name
 (c-defun-name)).
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000addba806320c7b4e"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 77557
Cc: 77557 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000addba806320c7b4e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sat, Apr 5, 2025 at 2:42=E2=80=AFPM Alan Mackenzie <acm@HIDDEN> wrote:

> Hello, Emacs.
>
> In my .emacs I have the following:
>
> (eval-after-load "cc-mode"
>   '(progn
>      (if (not (fboundp 'c-display-defun-name))
>          (defun c-display-defun-name (&optional arg)
>            "Display the name of the current CC mode defun and the positio=
n
> in it.
> With a prefix arg, push the name onto the kill ring too."
>            (interactive "P")
>            (save-restriction
>              (widen)
>              (c-save-buffer-state ((name (c-defun-name))   <=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
>                                    (limits (c-declaration-limits t))
>                                    (point-bol (c-point 'bol)))
>                (when name
>                  (message "%s.  Line %s/%s." name
>                           (1+ (count-lines (car limits) point-bol))
>                           (count-lines (car limits) (cdr limits)))
>                  (if arg (kill-new name))
>                  (sit-for 3 t))))))
>      (define-key c-mode-base-map "\C-cn" 'c-display-defun-name)
>      (put 'c-display-defun-name 'isearch-scroll t)))
>
> ..  While attempting to start my Emacs, the current Emacs master errors
> out with this form, giving the message:
>
>  stop  Warning (initialization): An error occurred while loading
> =E2=80=98/home/acm/.emacs=E2=80=99:
>
> error: Eager macro-expansion failure: (wrong-type-argument symbolp (name
> (c-defun-name))).
>
> ########################################################################
>
> The cause of the error is in macroexp--expand-all in the pcase subform
> near the end:  (`(,func . ,_) ....).  This subform triggers on (name
> (c-defun-name)) and calls (function-get '(name (c-defun-name))),
> thinking that ,func is a symbol.
>
> This bug became visible after this commit:
>
> commit a4ec9ca12969018cdf15b8cc713b3ba054326f99
> Author: Stefan Kangas <stefankangas@HIDDEN>
> Date:   Tue Apr 1 21:25:33 2025 +0200
>
>     function-put: signal error with non-symbol
>
> ..  Before that commit function-get returned nil for a non-symbol
> argument.
>
> #########################################################################
>
> The following patch fixes the bug:
>
>
> diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
> index 64ec634620a..8fd596ef58c 100644
> --- a/lisp/emacs-lisp/macroexp.el
> +++ b/lisp/emacs-lisp/macroexp.el
> @@ -489,7 +489,7 @@ macroexp--expand-all
>                    (macroexp--unfold-lambda `(,fn ,eexp . ,eargs)))
>                   (_ `(,fn ,eexp . ,eargs)))))
>              (`(funcall . ,_) form)      ;bug#53227
> -            (`(,func . ,_)
> +            (`(,(and func (pred symbolp)) . ,_)
>               (let ((handler (function-get func 'compiler-macro)))
>                 ;; Macro expand compiler macros.  This cannot be delayed =
to
>                 ;; byte-optimize-form because the output of the
> compiler-macro can
>

Looks like this bug reported today
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77550

--000000000000addba806320c7b4e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_default" style=3D"fon=
t-family:monospace"><span style=3D"font-family:Arial,Helvetica,sans-serif">=
On Sat, Apr 5, 2025 at 2:42=E2=80=AFPM Alan Mackenzie &lt;<a href=3D"mailto=
:acm@HIDDEN">acm@HIDDEN</a>&gt; wrote:</span></div></div><div class=3D"gmai=
l_quote gmail_quote_container"><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex">Hello, Emacs.<br>
<br>
In my .emacs I have the following:<br>
<br>
(eval-after-load &quot;cc-mode&quot;<br>
=C2=A0 &#39;(progn<br>
=C2=A0 =C2=A0 =C2=A0(if (not (fboundp &#39;c-display-defun-name))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(defun c-display-defun-name (&amp;optiona=
l arg)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;Display the name of the curr=
ent CC mode defun and the position in it.<br>
With a prefix arg, push the name onto the kill ring too.&quot;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(interactive &quot;P&quot;)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-restriction<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(widen)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(c-save-buffer-state ((name=
 (c-defun-name))=C2=A0 =C2=A0&lt;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(limits (c-declaration-=
limits t))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(point-bol (c-point &#3=
9;bol)))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when name<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(message &quo=
t;%s.=C2=A0 Line %s/%s.&quot; name<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 (1+ (count-lines (car limits) point-bol))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 (count-lines (car limits) (cdr limits)))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if arg (kill=
-new name))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(sit-for 3 t)=
)))))<br>
=C2=A0 =C2=A0 =C2=A0(define-key c-mode-base-map &quot;\C-cn&quot; &#39;c-di=
splay-defun-name)<br>
=C2=A0 =C2=A0 =C2=A0(put &#39;c-display-defun-name &#39;isearch-scroll t)))=
<br>
<br>
..=C2=A0 While attempting to start my Emacs, the current Emacs master error=
s<br>
out with this form, giving the message: <br>
<br>
=C2=A0stop=C2=A0 Warning (initialization): An error occurred while loading =
=E2=80=98/home/acm/.emacs=E2=80=99:<br>
<br>
error: Eager macro-expansion failure: (wrong-type-argument symbolp (name (c=
-defun-name))).<br>
<br>
########################################################################<br=
>
<br>
The cause of the error is in macroexp--expand-all in the pcase subform<br>
near the end:=C2=A0 (`(,func . ,_) ....).=C2=A0 This subform triggers on (n=
ame<br>
(c-defun-name)) and calls (function-get &#39;(name (c-defun-name))),<br>
thinking that ,func is a symbol.<br>
<br>
This bug became visible after this commit:<br>
<br>
commit a4ec9ca12969018cdf15b8cc713b3ba054326f99<br>
Author: Stefan Kangas &lt;<a href=3D"mailto:stefankangas@HIDDEN" target=
=3D"_blank">stefankangas@HIDDEN</a>&gt;<br>
Date:=C2=A0 =C2=A0Tue Apr 1 21:25:33 2025 +0200<br>
<br>
=C2=A0 =C2=A0 function-put: signal error with non-symbol<br>
<br>
..=C2=A0 Before that commit function-get returned nil for a non-symbol<br>
argument.<br>
<br>
#########################################################################<b=
r>
<br>
The following patch fixes the bug:<br>
<br>
<br>
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el<br>
index 64ec634620a..8fd596ef58c 100644<br>
--- a/lisp/emacs-lisp/macroexp.el<br>
+++ b/lisp/emacs-lisp/macroexp.el<br>
@@ -489,7 +489,7 @@ macroexp--expand-all<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(macro=
exp--unfold-lambda `(,fn ,eexp . ,eargs)))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (_ `(,fn ,ee=
xp . ,eargs)))))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(`(funcall . ,_) form)=C2=
=A0 =C2=A0 =C2=A0 ;bug#53227<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (`(,func . ,_)<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (`(,(and func (pred symbolp)) . =
,_)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((handler (function-g=
et func &#39;compiler-macro)))<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Macro expand com=
piler macros.=C2=A0 This cannot be delayed to<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; byte-optimize-fo=
rm because the output of the compiler-macro can<br></blockquote><div>=C2=A0=
</div><div><span style=3D"font-family:monospace">Looks like this bug report=
ed today=C2=A0</span><a href=3D"https://debbugs.gnu.org/cgi/bugreport.cgi?b=
ug=3D77550" style=3D"font-family:monospace">https://debbugs.gnu.org/cgi/bug=
report.cgi?bug=3D77550</a>=C2=A0</div></div></div>

--000000000000addba806320c7b4e--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#77557; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Apr 2025 18:41:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 05 14:41:28 2025
Received: from localhost ([127.0.0.1]:44760 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u18SO-0007mb-83
	for submit <at> debbugs.gnu.org; Sat, 05 Apr 2025 14:41:28 -0400
Received: from lists.gnu.org ([2001:470:142::17]:39416)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1u18SL-0007mM-8z
 for submit <at> debbugs.gnu.org; Sat, 05 Apr 2025 14:41:25 -0400
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 <acm@HIDDEN>) id 1u18SE-0007yU-JF
 for bug-gnu-emacs@HIDDEN; Sat, 05 Apr 2025 14:41:18 -0400
Received: from mail.muc.de ([193.149.48.3])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acm@HIDDEN>) id 1u18SC-00031o-Lo
 for bug-gnu-emacs@HIDDEN; Sat, 05 Apr 2025 14:41:18 -0400
Received: (qmail 77680 invoked by uid 3782); 5 Apr 2025 20:41:01 +0200
Received: from muc.de (p4fe151b3.dip0.t-ipconnect.de [79.225.81.179]) (using
 STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP;
 Sat, 05 Apr 2025 20:41:00 +0200
Received: (qmail 17965 invoked by uid 1000); 5 Apr 2025 18:41:00 -0000
Date: Sat, 5 Apr 2025 18:41:00 +0000
To: bug-gnu-emacs@HIDDEN
Subject: master: macroexp--expand-all mismatches on (name (c-defun-name)).
Message-ID: <Z_F5PKh1y9IrJHdN@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
X-Submission-Agent: TMDA/1.3.x (Ph3nix)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
Received-SPF: pass client-ip=193.149.48.3; envelope-from=acm@HIDDEN;
 helo=mail.muc.de
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

Hello, Emacs.

In my .emacs I have the following:

(eval-after-load "cc-mode"
  '(progn
     (if (not (fboundp 'c-display-defun-name))
         (defun c-display-defun-name (&optional arg)
           "Display the name of the current CC mode defun and the position in it.
With a prefix arg, push the name onto the kill ring too."
           (interactive "P")
           (save-restriction
             (widen)
             (c-save-buffer-state ((name (c-defun-name))   <============
                                   (limits (c-declaration-limits t))
                                   (point-bol (c-point 'bol)))
               (when name
                 (message "%s.  Line %s/%s." name
                          (1+ (count-lines (car limits) point-bol))
                          (count-lines (car limits) (cdr limits)))
                 (if arg (kill-new name))
                 (sit-for 3 t))))))
     (define-key c-mode-base-map "\C-cn" 'c-display-defun-name)
     (put 'c-display-defun-name 'isearch-scroll t)))

..  While attempting to start my Emacs, the current Emacs master errors
out with this form, giving the message: 

 stop  Warning (initialization): An error occurred while loading ‘/home/acm/.emacs’:

error: Eager macro-expansion failure: (wrong-type-argument symbolp (name (c-defun-name))).

########################################################################

The cause of the error is in macroexp--expand-all in the pcase subform
near the end:  (`(,func . ,_) ....).  This subform triggers on (name
(c-defun-name)) and calls (function-get '(name (c-defun-name))),
thinking that ,func is a symbol.

This bug became visible after this commit:

commit a4ec9ca12969018cdf15b8cc713b3ba054326f99
Author: Stefan Kangas <stefankangas@HIDDEN>
Date:   Tue Apr 1 21:25:33 2025 +0200

    function-put: signal error with non-symbol

..  Before that commit function-get returned nil for a non-symbol
argument.

#########################################################################

The following patch fixes the bug:


diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index 64ec634620a..8fd596ef58c 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -489,7 +489,7 @@ macroexp--expand-all
                   (macroexp--unfold-lambda `(,fn ,eexp . ,eargs)))
                  (_ `(,fn ,eexp . ,eargs)))))
             (`(funcall . ,_) form)      ;bug#53227
-            (`(,func . ,_)
+            (`(,(and func (pred symbolp)) . ,_)
              (let ((handler (function-get func 'compiler-macro)))
                ;; Macro expand compiler macros.  This cannot be delayed to
                ;; byte-optimize-form because the output of the compiler-macro can


-- 
Alan Mackenzie (Nuremberg, Germany).




Acknowledgement sent to Alan Mackenzie <acm@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#77557; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 5 Apr 2025 19:00:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.