0

I have just installed Emacs 27.9 on a new Mac running Monterey 12.0.1 (using https://emacsformacosx.com)

I then installed org-ref by putting the following lines in my .emacs:

(add-to-list 'load-path "~/.emacs.d/")
(load "org-ref-melpa.el")

For me the file "org-ref-melpa.el" is set up as follows:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SETUP FOR ORG-REF ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq user-emacs-directory "~/EMACS/org-ref/sandbox")

(require 'cl)
(require 'package)
(setq package-archives
      '(("org" . "http://orgmode.org/elpa/")
        ("gnu" . "http://elpa.gnu.org/packages/")
        ("melpa" . "http://melpa.org/packages/")))

(package-initialize)

(let ((packages (list 'org-plus-contrib 'org-ref)))
  ; refresh if needed.
  (unless (cl-every #'package-installed-p packages)
    (package-refresh-contents))

  (dolist (package packages)
    (unless (package-installed-p package)
      (package-install package))))

;; wrap lines
(global-visual-line-mode 1)

;; setup org-ref
(setq org-ref-bibliography-notes "~/EMACS/org-ref/notes.org"
      org-ref-default-bibliography '("~/EMACS/org-ref/references.bib")
      org-ref-pdf-directory "~/EMACS/org-ref/bibtex-pdfs/")

(unless (file-exists-p org-ref-pdf-directory)
  (make-directory org-ref-pdf-directory t))

;; Some org-mode customization
(setq org-src-fontify-natively t
      org-confirm-babel-evaluate nil
      org-src-preserve-indentation t)

(org-babel-do-load-languages
 'org-babel-load-languages '((python . t)))

(setq org-latex-pdf-process
      '("pdflatex -interaction nonstopmode -output-directory %o %f"
        "bibtex %b"
        "pdflatex -interaction nonstopmode -output-directory %o %f"
        "pdflatex -interaction nonstopmode -output-directory %o %f"))

(setq bibtex-autokey-year-length 4
      bibtex-autokey-name-year-separator "-"
      bibtex-autokey-year-title-separator "-"
      bibtex-autokey-titleword-separator "-"
      bibtex-autokey-titlewords 2
      bibtex-autokey-titlewords-stretch 1
      bibtex-autokey-titleword-length 5)

(require 'dash)
(setq org-latex-default-packages-alist
      (-remove-item
       '("" "hyperref" nil)
       org-latex-default-packages-alist))

;; Append new packages
(add-to-list 'org-latex-default-packages-alist '("" "natbib" "") t)
(add-to-list 'org-latex-default-packages-alist
             '("linktocpage,pdfstartview=FitH,colorlinks,
linkcolor=blue,anchorcolor=blue,
citecolor=blue,filecolor=blue,menucolor=blue,urlcolor=blue"
               "hyperref" nil)
             t)

;; some requires for basic org-ref usage
(require 'org-ref)
(require 'org-ref-pdf)
(require 'org-ref-url-utils)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

That is its the same as the version of the file found on:

https://kitchingroup.cheme.cmu.edu/blog/2015/12/22/org-ref-is-on-Melpa/

with minimal changes.

Now when I try to set up a bibliography file by typing for example:

bibliography:newref.bib

And then click on the link (as explained in the video in Kitchin's introductory video https://www.youtube.com/watch?v=2t925KRBbFc)

I get the error:

(wrong-type-argument stringp nil)

If I use the debugger: (setq debug-on-error t), I get:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-exists-p(nil)
  org-ref-get-bibfile-path(nil)
  org-ref-bibliography*-follow("newref.bib")
  org-link-open((link (:type "bibliography" :path "newref.bib" :format plain :raw-link "bibliography:newref.bib" :application nil :search-option nil :begin 88 :end 111 :contents-begin nil :contents-end nil :post-blank 0 :parent (paragraph (:begin 88 :end 114 :contents-begin 88 :contents-end 112 :post-blank 2 :post-affiliated 88 :parent nil)))) nil)
  org-open-at-point()
  org-open-at-mouse((mouse-2 (#<window 7 on manuscript.org> 97 (68 . 64) 140230978 nil 97 (9 . 4) nil (5 . 8) (7 . 14))))
  funcall-interactively(org-open-at-mouse (mouse-2 (#<window 7 on manuscript.org> 97 (68 . 64) 140230978 nil 97 (9 . 4) nil (5 . 8) (7 . 14))))
  call-interactively(org-open-at-mouse nil nil)
  command-execute(org-open-at-mouse)

I'm really very new to all things EMACS so if anyone out there can help me with this can you please give instructions that can be understood by a newb!

1

2 Answers 2

0

Here’s the source of the org-ref-bibliography*-follow function. It is looking for a text property containing the filename to jump to, but apparently it isn’t finding it; you can see in the stack that it is passing nil to the next function along instead of a file name. Perhaps your file is not quite in the right format. The org-ref package should have better error handling though.

I would file a bug report if I were you.

1
0

Turns out I was using a very old version of org-ref, here is the response I got from the above GitHub page:

"You are using a very out of date configuration. See https://github.com/jkitchin/org-ref#configuration for an updated setup.

See https://www.youtube.com/watch?v=3u6eTSzHT6s&list=PL0sMmOaE_gs3E0OjExoI7vlCAVygj6S4I&index=11&t=446s for a more recent video.

I would start there."

Installing the newer version of org-roam now works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.