J-ky · 2022-05-01 09:13
I have been dealing with this issue for months, I use straight to manage emacs packages, so that I am always at the latest version of org mode.
I am currently at org 9.5.3. I have been constantly dealing with a lot of missing function definitions. Most of them are due to compatibility reasons, e.g. some other packages depends on org-mode may use an old name for certain kind of functions. But this should not be an issue at all, because there is an "org-compat.el" which takes care of them.
However, I find that, org-compat.el was never loaded in my emacs, even though I have (require 'org) in the first place, in org.el, org-compat was already required. I even tried to directly load the org-compat.el myself using (require 'org-compat). But none of the definition in the file was loaded.
I wonder if that has anything to do with native-compilation. Anyone has an idea of how to fix this issue? I have to manually go to the org-compat.el file every single time after I restart emacs to make it works.
Not only was org-compat.el not loaded, the org-macs.el was also not loaded. It has become a nightmare for me to use org-mode in the recent months.
Phil-Hudson · 2022-05-01 09:25
First: you say org-compat was never loaded. Did you verify this with `(featurep 'org-compat)` returning nil?
If so, try calling `M-x toggle-debug-on-error` and then evaluating `(require 'org-compat)`.
Last idea for now: not sure this will work, but I'd try uninstalling and reinstalling Org, making sure that all byte- and native-compiled files are deleted before reinstalling.
J-ky · 2022-05-01 09:53
If I use `(featurep 'org-compat)`, it evals into t. But let say there is a function, `org-file-name-concat` in org-compat, I cannot find it with C-h f. But if I manually go to the org-compat.el file and eval buffer, the function is then defined. It is stupidly weird. I believe that emacs thinks it has required org-compat, but in fact it does not.
There is no error when I eval `(require 'org-compat)`. No debug is shown.
I have rebuild the whole native-compiled files several times, did not help.
Finally I have found a ugly solution, I load the file directly in my config.
`(load "org-compat") (load "org-macs")`
With these, the necessary functions are finally loaded. Not sure if it is a bug or not.
Phil-Hudson · 2022-05-01 15:07
That really is weird. If you can provide a minimal reproducible recipe, starting with `emacs -Q`, then you may indeed have found a bug.
yantar92 · 2022-05-02 11:54
Most likely, you are partially loading built-in version of Org and its org-compat.el Try to put your straight-use-package org near the top of your config.
J-ky · 2022-05-02 12:49
You are right. I originally put the org part in the bottom of my init. After I move it to the front, the issue was solved. Thank you so much.
It is kind of embarrassing to make this kind of mistake.
yantar92 · 2022-05-02 13:01
You are not the first. This issue appears again and again every time new version of Org gets released. It was there back in 2011 (and got solved for package.el: https://list.orgmode.org/orgmode/81pqgh90sp.fsf@gmail.com/). It appears again with recent release: https://list.orgmode.org/orgmode/m25ytopjg9.fsf@blind-drunk.fritz.box/