Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org-node-backlink-fix-all error - Symbol's value as variable is void: org-file-buffer-created #12

Closed
semilin opened this issue May 12, 2024 · 7 comments

Comments

@semilin
Copy link

semilin commented May 12, 2024

This error occurs when running org-node-backlink-fix-all.
Not very helpful backtrace:

Debugger entered--Lisp error: (void-variable org-file-buffer-created)
  org-node-backlink-fix-all()
  funcall-interactively(org-node-backlink-fix-all)
  command-execute(org-node-backlink-fix-all record)
  execute-extended-command(nil "org-node-backlink-fix-all" nil)
  funcall-interactively(execute-extended-command nil "org-node-backlink-fix-all" nil)
  command-execute(execute-extended-command)

For some reason, the function correctly updates the current org buffer I'm looking at, but no other files. I'm on Emacs 30.0.50 if that matters - I'll try with a stable version later.

@meedstrom
Copy link
Owner

meedstrom commented May 12, 2024

Odd because if the code got to that point, it already ran org-with-file-buffer which is defined in org-macs.el, the same place where org-file-buffer-created is defined...

I put a require org-macs at the top, does it work?

@semilin
Copy link
Author

semilin commented May 12, 2024

I get the same error, but I realized that the error actually occurs during native compilation. I get these errors when starting emacs and loading org-node.

⛔ Warning (comp): org-node.el:692:13: Warning: the function ‘wgrep-finish-edit’ is not known to be defined.
⛔ Warning (comp): org-node.el:686:11: Warning: the function ‘wgrep-change-to-wgrep-mode’ is not known to be defined.
⛔ Warning (comp): org-node.el:436:19: Warning: the function ‘bol’ is not known to be defined.
⛔ Warning (comp): org-node.el:432:19: Warning: the function ‘eol’ is not known to be defined.
⛔ Warning (comp): org-node.el:245:24: Warning: the function ‘org-roam-capture-’ is not known to be defined.
⛔ Warning (comp): org-node.el:95:32: Warning: the function ‘org-roam-node-create’ is not known to be defined.
⛔ Warning (comp): org-node.el:90:22: Warning: the function ‘org-roam-node-slug’ is not known to be defined.
⛔ Warning (comp): org-node.el:81:10: Warning: the function ‘org-with-file-buffer’ is not known to be defined.
⛔ Warning (comp): org-node.el:73:4: Warning: the function ‘org-super-links-convert-link-to-super’ is not known to be defined.
⛔ Warning (comp): org-node.el:65:29: Warning: the function ‘prompt’ is not known to be defined.
⛔ Warning (comp): org-node-common.el:504:4: Warning: the function ‘org-node-cache-mode’ is not known to be defined.
⛔ Warning (comp): org-node-common.el:493:14: Warning: the function ‘org-node-backlink-mode’ is not known to be defined.
⛔ Warning (comp): org-node-common.el:472:14: Warning: the function ‘org-node-insert-heading’ is not known to be defined.
⛔ Warning (comp): org-node-common.el:462:14: Warning: the function ‘org-node-cache-rescan-file’ is not known to be defined.
⛔ Warning (comp): org-node-common.el:97:35: Warning: the function ‘org-node-new-file’ is not known to be defined.
⛔ Warning (comp): org-node-common.el:85:31: Warning: the function ‘org-node-slugify-as-url’ is not known to be defined.
⛔ Warning (comp): org-node-backlink.el:271:25: Warning: the function ‘org-transclusion-mode’ is not known to be defined.
⛔ Warning (comp): org-node-cache.el:82:21: Warning: the function ‘org-node-cache--collect’ is not known to be defined.
⛔ Warning (comp): org-node-cache.el:27:45: Warning: the function ‘org-node-cache--handle-delete’ is not known to be defined.
⛔ Warning (comp): org-node-backlink.el:235:18: Warning: the function ‘org-element-property’ is not known to be defined.
⛔ Warning (comp): org-node-backlink.el:74:14: Warning: the function ‘org-with-file-buffer’ is not known to be defined.
^
⛔ Warning (comp): org-node-roam.el:222:30: Warning: the function ‘org-roam-db’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:222:4: Warning: the function ‘emacsql-with-transaction’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:220:4: Warning: the function ‘org-roam-db--close’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:219:4: Warning: the function ‘org-roam-db-clear-all’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:143:6: Warning: the function ‘org-roam-db-query’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:119:32: Warning: the function ‘org-roam-org-ref-path-to-keys’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:100:34: Warning: the function ‘org-element-property’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:98:19: Warning: the function ‘org-element-map’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:77:32: Warning: the function ‘org-roam-reflink-create’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:52:17: Warning: the function ‘org-roam-backlink-create’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:45:21: Warning: the function ‘org-roam-node-id’ is not known to be defined.
⛔ Warning (comp): org-node-roam.el:15:4: Warning: the function ‘org-roam-node-create’ is not known to be defined.

I'm not familiar enough with native comp and package development to know what's going wrong here. It seems like the require calls aren't working at compile time.
I looked at some other org packages to see what they do, and I saw org-super-agenda.el has this:

;; I think this is the right way to do this...
(eval-when-compile
  (require 'org-macs))

I tried naively wrapping the org-macs require call in org-node.el and org-node-backlinks.el in eval-when-compile but that doesn't seem to fix the issue.

@meedstrom
Copy link
Owner

meedstrom commented May 12, 2024 via email

@semilin
Copy link
Author

semilin commented May 12, 2024

Huh, odd. No, the same behavior occurs. M-x org-node-backlink-fix-all prompts me if I want to edit the files, then warns me about auto git-commit systems, then Symbol's value as variable is void: org-file-buffer-created. When I run it again, it skips the prompting and errors immediately.

@meedstrom
Copy link
Owner

meedstrom commented May 12, 2024 via email

@semilin
Copy link
Author

semilin commented May 12, 2024

Figured out the issue - the symbols really didn't exist. org-node was using Emacs's built in org version, which doesn't yet have org-file-buffer-created or org-with-file-buffer implemented. I then installed org 9.7 through elpaca, but that didn't fix the problem. I had to add (require 'org) in org-node.el and org-node-backlink.el, forcing it to use the updated org, and I can now successfully run org-node-backlink-fix-all. Probably also worth noting in the README that the package requires a more recent version of org.

@meedstrom
Copy link
Owner

I must admit that was not in my hypothesis space at all. Thanks for figuring it out, you rock!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants