Subject: Re: bug#41381: 28.0.50; Can't compile file containing a local pcase macro

From: Philipp Stephani <[email-masked]>
Date: Sat, 6 Jun 2020 21:11:26 +0200

Am Mi., 3. Juni 2020 um 23:59 Uhr schrieb Pip Cet <[email-masked]>:
>
> Philipp Stephani <[email-masked]> writes:
> > $ cat test.el
> > ;;; -*- lexical-binding: t; -*-
> > (pcase-defmacro test () '_)
> > (defun test () (pcase nil ((test))))
> >
> > $ emacs -Q -batch -l bytecomp -f batch-byte-compile test.el
> >
> > In toplevel form:
> > test.el:3:1: Error: Symbol’s function definition is void: test--pcase-macroexpander
> >
> > It works if the pcase macro is surrounded with `eval-when-compile', but
> > that shouldn't be necessary I think.
>
> Wouldn't it be better to surround the pcase-defmacro call with
> (eval-and-compile ...)?

How about neither? This should work without any "eval-when-..." form.