From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#57972: 29.0.50; Autoloaded function raises (void-function org-element-cache-reset) when called within major-mode body Date: Wed, 21 Sep 2022 15:46:13 +0300 Message-ID: <83edw4vqsq.fsf@gnu.org> References: <87fsglxh24.fsf@localhost> <83k05xufhf.fsf@gnu.org> <8735clx8cl.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39343"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57972@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 21 15:37:26 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oazuo-000A7R-HE for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Sep 2022 15:37:26 +0200 Original-Received: from localhost ([::1]:37638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oazun-0002xH-F1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Sep 2022 09:37:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaz82-0006KI-Cr for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2022 08:47:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oaz82-0005v7-1Y for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2022 08:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oaz81-0006c9-Jq for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2022 08:47:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Sep 2022 12:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57972 X-GNU-PR-Package: emacs Original-Received: via spool by 57972-submit@debbugs.gnu.org id=B57972.166376438525380 (code B ref 57972); Wed, 21 Sep 2022 12:47:01 +0000 Original-Received: (at 57972) by debbugs.gnu.org; 21 Sep 2022 12:46:25 +0000 Original-Received: from localhost ([127.0.0.1]:32888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oaz7R-0006bI-Gw for submit@debbugs.gnu.org; Wed, 21 Sep 2022 08:46:25 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51702) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oaz7P-0006b1-V8 for 57972@debbugs.gnu.org; Wed, 21 Sep 2022 08:46:24 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47612) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaz7K-0005sD-6H; Wed, 21 Sep 2022 08:46:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=R+BxwAY/aIrCHPJ96Ri1kpj+iNr19EdsgS2879k9NnE=; b=QvM959m8iVt/ HIXT/w9vHbnTAlLZF1xLbSWmRw+RHEVtcIjE77NTmrg+ZLyIhktrZcggDljJcqSxi7q8/jrRkBSa/ tIMz5IvUmj1oUzfk5/luTOG+KEuJuMoG/bSRV+UeDpwJtQsg3iPJXCGRTdN9CE9M1evItfsmk/6aU HUSmCdupO12kRSO3VrLwt7q8QnUnMYhaEIWENcKwey4sbHVUVhoK7qCsRFV77SEugFBy0LBOWwtF8 USE2xfSxoIHqXHSNdgP+UYc3+AQ5pAJE6U/mqxKJZtOEH7yXimq2H2EKLwOhVv98jIrDT5OxSjhfE DB0bXidAhWx7fqZrHYe1XQ==; Original-Received: from [87.69.77.57] (port=3805 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaz76-0003zG-T0; Wed, 21 Sep 2022 08:46:17 -0400 In-Reply-To: <8735clx8cl.fsf@localhost> (message from Ihor Radchenko on Wed, 21 Sep 2022 19:41:46 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:243341 Archived-At: > From: Ihor Radchenko > Cc: 57972@debbugs.gnu.org > Date: Wed, 21 Sep 2022 19:41:46 +0800 > > Eli Zaretskii writes: > > > Would it be possible to have more info about the details? Like what > > are org-element-cache-reset and org-element-citation-prefix-re, and > > how do they enter the picture in the above scenario? > > Let's forget about org-element-citation-prefix-re for now. > > org-element-cache-reset is an autoloaded function defined inside > org-element.el > > Major mode body `org-mode' from org.el is calling > `org-element-cache-reset' as part of Org mode loading. > > org.el does not contain (require 'org-element). > Instead, it is assumed that `org-element-cache-reset' is autoloaded by > Emacs. org-element-cache-reset's autoload form is in org-loaddefs.el. The error message reported by the OP, viz.: File mode specification error: (void-function org-element-cache-reset) comes from normal-mode when it calls set-auto-mode. So something goes wrong there, perhaps because org-element-cache-reset is called before org.el loads org-loaddefs.el with this snippet: (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)))) I don't know what goes wrong, because I cannot reproduce the problem here, if I just visit a (non-existent) foo.org. After visiting the file, (fboundp 'org-element-cache-reset) yields t. So I have questions: . does this happen in "emacs -Q"? . does org-loaddefs.el exist on load-path, and is it being loaded by org.el? . could it be that user customizations somehow define file-local variables or directory-local variables or something else that attempts to use org-element-cache-reset too early? 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.