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

Error loading org-ref-latex #1116

Open
vcurdia opened this issue May 31, 2024 · 10 comments
Open

Error loading org-ref-latex #1116

vcurdia opened this issue May 31, 2024 · 10 comments

Comments

@vcurdia
Copy link

vcurdia commented May 31, 2024

When starting emacs I get the following error message:
Warning (comp): /home/vasco/.emacs.d/elpa/org-ref-20240509.1211/org-ref-latex.el: Error: Symbol's function definition is void org-link-set-parameters

My org-ref setup is as follows:

(use-package org-ref
  :config
  (require 'bibtex)
  (require 'org-ref-helm)
  (require 'org-ref-latex)
  (setq org-ref-insert-link-function 'org-ref-insert-link-hydra/body
	    org-ref-insert-cite-function 'org-ref-cite-insert-helm
	    org-ref-insert-label-function 'org-ref-insert-label-link
	    org-ref-insert-ref-function 'org-ref-insert-ref-link
	    org-ref-cite-onclick-function (lambda (_) (org-ref-citation-hydra/body))
	    org-ref-notes-function 'orb-edit-notes)
  (define-key org-mode-map (kbd "C-c ]") 'org-ref-insert-link)
  )

Am I missing something?
Thanks

@jkitchin
Copy link
Owner

that sounds like you have an old version of org that is loading. If you run M-x org-version what do you see?

@vcurdia
Copy link
Author

vcurdia commented May 31, 2024

I get
Org mode version 9.6.15 (release_9.6.15 @ /snap/emacs/current/usr/share/emacs/29.3/lisp/org/)

Note: I am trying to get clickable citations/preview in auctex and that's why I am trying to add org-ref-latex to my setup. Right now it doesn't work, and maybe this is why.

@vcurdia
Copy link
Author

vcurdia commented May 31, 2024

When I check my package list, for org I get the information below.

Package org is built-in.

 Status: Built-In.
Version: 9.6.15
Summary: Outline-based notes management and organizer

Required by: ox-pandoc-20231222.1103, org-super-agenda-20240301.1602,
org-roam-20240114.1941, org-ref-20240509.1211,
org-ql-20240403.2027, org-appear-20231127.1052,
citeproc-20240513.1309, citar-20240419.2232
Other versions: 9.6.30 (gnu).

Org is a mode for keeping notes, maintaining ToDo lists, and doing
project planning with a fast and effective plain-text system.

Org mode develops organizational tasks around NOTES files that
contain information about projects as plain text. Org mode is
implemented on top of outline-mode, which makes it possible to keep
the content of large files well structured. Visibility cycling and
structure editing help to work with the tree. Tables are easily
created with a built-in table editor. Org mode supports ToDo
items, deadlines, time stamps, and scheduling. It dynamically
compiles entries into an agenda that utilizes and smoothly
integrates much of the Emacs calendar and diary. Plain text
URL-like links connect to websites, emails, Usenet messages, BBDB
entries, and any files related to the projects. For printing and
sharing of notes, an Org file can be exported as a structured ASCII
file, as HTML, or (todo and agenda items only) as an iCalendar
file. It can also serve as a publishing tool for a set of linked
webpages.

Installation and Activation

See the corresponding sections in the manual at

https://orgmode.org/org.html#Installation

Documentation

The documentation of Org mode can be found in the TeXInfo file. The
distribution also contains a PDF version of it. At the Org mode website,
you can read the same text online as HTML. There is also an excellent
reference card made by Philip Rooke. This card can be found in the
doc/ directory.

A list of recent changes can be found at
https://orgmode.org/Changes.html

@vcurdia
Copy link
Author

vcurdia commented May 31, 2024

I was able to install org version 9.6.30 but I still get the same warning/error message

@jkitchin
Copy link
Owner

jkitchin commented Jun 1, 2024

It seems very weird, I wonder if the wrong org is loaded when org-ref is loaded. In my init files I have something like:

(use-package org)
(use-package org-ref)
(use-package org-ref-ivy
  :load-path (lambda () (file-name-directory (locate-library "org-ref"))))

I think you could replace org-ref-ivy with org-ref-helm. I don't know why I do it this way, the code is quite old, but I guess there was a reason for it. I make sure org is the first thing that is ever loaded before anything else, otherwise a default system org might get loaded first, and that might be a version 8 before the new link commands were defined?

@vcurdia
Copy link
Author

vcurdia commented Jun 2, 2024

Thanks. I've tried that approach with either helm or ivy and neither solved the issue with loading org-ref-latex.
I get org-version 9.6.30 when I check.
I also know that the built-in org version that I was using was 9.6.15. So either way I'm already using v9, not v8.
The rest of org-ref works fine. It's just the org-ref-latex that does not work.

@jkitchin
Copy link
Owner

jkitchin commented Jun 2, 2024

That is very strange. It must be coming from trying to load org-ref-citation-links, but I don't understand why.

You might check this page:
https://www.reddit.com/r/emacs/comments/5avfin/symbols_function_definition_is_void

another possibility might be to put your org-ref loading code inside this macro.

(with-eval-after-load 'org
  ;; Org config goes here
  ;; ....
  )

@vcurdia
Copy link
Author

vcurdia commented Jun 2, 2024

I tried that but not success so far.

What I have discovered is that the warning/error is caused by this block (if I comment out the other instructions after this block and recompile/load org-ref-latex):

(defun org-ref-latex-get-bibliography ()
  "Find bibliographies in the tex file."
  (save-excursion
    (let ((bibliography '()))
      (goto-char (point-min))
      (while (re-search-forward "\\\\bibliography{\\(?1:.*\\)}" nil t)
	    (setq bibliography (append bibliography
				                   (mapcar (lambda (f)
					                         (concat f ".bib"))
					                       (split-string (match-string-no-properties 1) ",")))))
      (goto-char (point-min))
      (while (re-search-forward "\\\\addbibresource{\\(?1:.*\\)}" nil t)
	    (setq bibliography (append bibliography (list (match-string-no-properties 1)))))
      bibliography)))

@jkitchin
Copy link
Owner

jkitchin commented Jun 2, 2024

Do you mean it happens after this block? That particular defun doesn't even have org-related code in it.

can you skip loading org-ref-latex in your init and then after your Emacs loads, load it with M-x load-library org-ref-latex?

Is there any output if you start emacs with --debug-init?

Another way I would debug this is to also skip loading it in your init, and then evaluate each form in org-ref-latex and check the traceback when you get to the error.

jkitchin added a commit that referenced this issue Jun 2, 2024
@vcurdia
Copy link
Author

vcurdia commented Jun 9, 2024

I agree that it is odd. What I did exactly was to comment the entire contents (except the final provide), and then gradually remove the comments.

It loaded without errors until I loaded that segment.

I was indeed surprised because as you say it does not appear to call the problematic function.

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