Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 14 characters in body
Source Link
Drew
  • 79.1k
  • 10
  • 123
  • 257

Thanks!!

Thanks!!

Source Link

Org ref: (wrong-type-argument stringp nil)

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!

Thanks!!