Subject: 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 21:00:08 +0800

>
> Alternatively, a complete recipe (without referring to directories
> that I definitely don't have here) to reproduce the problem could
> answer all those questions succinctly and efficiently.
>

Here it is
1. cd /tmp
2. git clone git://git.sv.gnu.org/emacs/org-mode.git
3. cd org-mode
4. make autoloads
5. Create /tmp/bug.el with the following contents:
-----
(add-to-list 'load-path "/tmp/org-mode/lisp")
(require 'org)
-----
6. Create /tmp/bug.org with the following contents:
-----
* TODO start clock on this test item
-----
7. emacs -Q /tmp/bug.el
8. M-x eval-buffer
9. C-x C-f /tmp/bug.org
10. Observe error in echo area

Note that doing emacs -Q -l /tmp/bug.el in step 7 does _not_ trigger the
error.

Best,
Ihor