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

From: Eli Zaretskii <[email-masked]>
Date: Wed, 21 Sep 2022 17:27:12 +0300

> From: Ihor Radchenko <[email-masked]>
> Date: Wed, 21 Sep 2022 22:10:24 +0800
> Cc: [email-masked]
> 
>  > I cannot reproduce on stable branch either. Only on main.
> 
>  Then why do you think this is a problem in the core?
> 
> As I said in my first message, I either misunderstand something about autoload or it is some kind of
> Emacs bug. 
> 
> Note that doing emacs -Q -l /tmp/bug.el vs emacs -Q /tmp/bug.el + eval-buffer yields different results.
> I cannot possibly see how it can be anything to do with Org and I have no clue how to approach debugging
> this.

Fair enough.

Would it help to make the backtrace more detailed?  Right now, we
don't see anything between the call to normal-mode and the error.  If
you manually "M-x load-file RET files.el RET" before doing
eval-buffer, do you get a more detailed backtrace?

And another thing: do you have any clue (or maybe more than a clue)
what changes in Org wrt what's on the Emacs master branch could have
caused this?  If you do, can you show those changes, or point to the
specific places in Org files where those changes can be eye-balled?