On Sat, Apr 5, 2025 at 2:42 PM Alan Mackenzie <acm@muc.de> 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 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@gmail.com>
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=77550