Subject: Re: bug#59900: 30.0.50; map pattern in pcase causes a byte-compile error

From: Michael Heerdegen <[email-masked]>
Date: Fri, 09 Dec 2022 03:11:14 +0100

Akira Komamura <[email-masked]> writes:

> I encountered similar errors in other libraries that contain a `map' pattern
> inside a `pcase' form. It didn't happen until recently, when I updated Emacs
> and
> began to get those errors.
>
>  So I wonder where's the place in the core Emacs sources
>  which causes the problem, and I couldn't find it.  I'm probably
>  missing something.

Maybe it started with

| 85555ad3b79 ; Require map only during compilation
| Philip Kaludercic <[email-masked]> 2022-10-23

Anyway, AFAIU currently compiling pcase forms with `map' patterns
requires map.el to be currently loaded, and since you can't (and could
not) rely on that, it's better to add
(eval-when-compile (require 'map)).

> There are some other additional patterns for `pcase'. One of them is `rx'
> pattern. There is an autoload cookie right above the definition of
> `(pcase-defmacro rx ...' in `rx.el'. On the other hand, there is no autoload
> above `(pcase-defmacro map ...' in `map.el'. I think this might be the cause.
> Is there any reason for not autoloading the `pcase-defmacro` form?

I see no reason, it should be doable.

Michael.