GNU bug report logs - #57972
29.0.50; Autoloaded function raises (void-function org-element-cache-reset) when called within major-mode body

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> gmail.com>

Date: Wed, 21 Sep 2022 08:34:01 UTC

Severity: normal

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#57972: closed (29.0.50; Autoloaded function raises
 (void-function org-element-cache-reset) when called within major-mode
 body)
Date: Fri, 23 Sep 2022 07:15:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 23 Sep 2022 10:14:17 +0300
with message-id <838rmar29i.fsf <at> gnu.org>
and subject line Re: bug#57972: 29.0.50; Autoloaded function raises (void-function org-element-cache-reset) when called within major-mode body
has caused the debbugs.gnu.org bug report #57972,
regarding 29.0.50; Autoloaded function raises (void-function org-element-cache-reset) when called within major-mode body
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
57972: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57972
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ihor Radchenko <yantar92 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Autoloaded function raises (void-function
 org-element-cache-reset) when called within major-mode body
Date: Wed, 21 Sep 2022 16:33:39 +0800
Hi,

I am forwarding a bug report from Org mode.
https://list.orgmode.org/4a9d4298-4af6-3e11-63c3-87bf7125f61b <at> oracle.com/T/#u

I am able to reproduce the reported steps (see below) and I find that
the void-function error is raised when calling (org-mode). `org-mode'
body calls `org-element-cache-reset', which should be autoloaded from
org-element.el. Yet, void-function error is raised.

I either misunderstand something about autoload or it is some kind of
Emacs bug.

Steps to reproduce:

https://list.orgmode.org/4a9d4298-4af6-3e11-63c3-87bf7125f61b <at> oracle.com/T/#u

Org mode version is the latest from
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/

> I ran this:
> dortmann <at> ddo-linux:.emacs.d$ emacs -Q --debug-init asdf.el
> ... and then ran eval-buffer.
> 
> Where asdf.el has this content:
> (add-to-list 'load-path "/home/dortmann/src/git-org-mode/lisp")
> (require 'org)
> 
> (setq org-capture-templates
>        `(("c" "Item to current clocked task" checkitem
>         (clock)
>         "%i%?" :prepend t :empty-lines 1)))
> 
> Then I loaded asdf.org which has this:
> * TODO start clock on this test item

> These two lines are in my *Messages* buffer:
> File mode specification error: (void-function org-element-cache-reset)
> Error during redisplay: (jit-lock-function 1) signaled (void-variable 
> org-element-citation-prefix-re)

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.34, cairo version 1.16.0) of 2022-09-07 built on localhost
Repository revision: 473313d2a85a7ae73daf5cc7c205f6285286eecf
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Gentoo Linux

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92


[Message part 3 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Ihor Radchenko <yantar92 <at> gmail.com>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 57972-done <at> debbugs.gnu.org
Subject: Re: bug#57972: 29.0.50; Autoloaded function raises (void-function
 org-element-cache-reset) when called within major-mode body
Date: Fri, 23 Sep 2022 10:14:17 +0300
> From: Ihor Radchenko <yantar92 <at> gmail.com>
> Cc: 57972 <at> debbugs.gnu.org
> Date: Fri, 23 Sep 2022 10:10:32 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >   (or (eq this-command 'eval-buffer)  <<<<<<<<<<<<<<<<<<<<<
> >       (condition-case nil
> > 	  (load (concat (file-name-directory load-file-name)
> > 			"org-loaddefs")
> > 		nil t nil t)
> > 	(error
> > 	 (message "WARNING: No org-loaddefs.el file could be found from where org.el is loaded.")
> > 	 (sit-for 3)
> > 	 (message "You need to run \"make\" or \"make autoloads\" from Org lisp directory")
> > 	 (sit-for 3))))
> >
> > explicitly avoids loading org-loaddefs.el if org.el was loaded via
> > eval-buffer.  Which is exactly the case here, isn't it, and explains
> > why the loaddefs aren't loaded?
> >
> > So now the question becomes: why does org.el treat eval-buffer in this
> > special way?  Perhaps because of byte-compilation or something?
> 
> I have no clue. I will ask Bastien (he authored this piece of code).
> 
> I hence see this Emacs bug report as resolved (it is not an Emacs bug).

Thanks, so I'm closing this bug.

> Side question: Could you point me towards documentation on how to
> properly do autoloading in Emacs packages? Maybe Org is doing things
> wrongly?

I think Org basically does what other packages do, which is explicitly
load the *-loaddefs.el in some central place.  I don't think we have
any magic anywhere to do that any other way.

Lars, Stefan: am I missing something?


This bug report was last modified 2 years and 299 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.