Subject: Re: bug#57972: 29.0.50; Autoloaded function raises (void-function org-element-cache-reset) when called within major-mode body

From: Ihor Radchenko <[email-masked]>
Date: Wed, 21 Sep 2022 20:32:10 +0800

>
> > You have some confusing stuff in org.el -- you have a
>
> > (declare-function org-element-cache-reset "org-element" (&optional all))
>
> > to suppress warnings in org.el about that function, but
> > org-element-cache-reset should be in org-loaddefs, which org.el loads
> > already, so it should be unnecessary.

The declare statement is there for a single reason---to pacify native-comp
warnings.

 If it isn't unnecessary, then something else is going wrong somewhere,

> I'd have thought?  But I haven't tried debugging further.
>

I removed the declare statement. The bug persists. Also,
org-element-cache-reset is present in org-loaddefs.el

Best,
Ihor