0

I have been trying to use the org-ref package with emacs and I copied the setup presented in the package where I placed the .bib files in a directory called ~/papers/ along with any pdfs of the papers in the same folder:

(use-package ivy-bibtex
    :straight t
    :init
    (setq bibtex-completion-bibliography '("~/papers/phd_ref.bib"
                                           "~/papers/masc_ref.bib")
          bibtex-completion-library-path '("~/papers/")
          bibtex-completion-notes-path "~/papers/"
          bibtex-completion-notes-template-multiple-files "* ${author-or-editor}, ${title}, ${journal}, (${year}) :${=type=}: \n\nSee [[cite:&${=key=}]]\n"

          bibtex-completion-additional-search-fields '(keywords)
          bibtex-completion-display-formats
          '((article       . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${journal:40}")
            (inbook        . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} Chapter ${chapter:32}")
            (incollection  . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}")
            (inproceedings . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}")
            (t             . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*}"))
          bibtex-completion-pdf-open-function
          (lambda (fpath)
            (call-process "open" nil 0 nil fpath))))

(use-package org-ref
    :straight t
    :init
    (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)
)
(define-key org-mode-map (kbd "C-c ]") org-ref-insert-cite-function)
(define-key org-mode-map (kbd "C-c r") org-ref-insert-ref-function)
(define-key org-mode-map (kbd "C-c l") org-ref-insert-label-function)

I am able to insert the citation using C-c ] and when I click on the citation, I can press p to open its pdf which I have also downloaded and kept in the same ~/papers/ folder. But when I press p , it does not open the pdf file and simply states Searching for program: No such file or directory, open. My goal was to click on the citation link and have org-noter open it up so I can start taking notes on the paper. So how can I configure org-ref to properly open up the pdf file?

Here is the error I receive:

Debugger entered--Lisp error: (file-missing "Searching for program" "No such file or directory" "open")
  call-process("open" nil 0 nil "/home/user/papers/huang91_optic_coher_tomog.pdf")
  (lambda (fpath) (call-process "open" nil 0 nil fpath))("/home/user/papers/huang91_optic_coher_tomog.pdf")
  org-ref-open-pdf-at-point()
  funcall-interactively(org-ref-open-pdf-at-point)
  call-interactively(org-ref-open-pdf-at-point)
  hydra--call-interactively-remap-maybe(org-ref-open-pdf-at-point)
  org-ref-citation-hydra/org-ref-open-pdf-at-point-and-exit()
  funcall-interactively(org-ref-citation-hydra/org-ref-open-pdf-at-point-and-exit)
  call-interactively(org-ref-citation-hydra/org-ref-open-pdf-at-point-and-exit nil nil)
  command-execute(org-ref-citation-hydra/org-ref-open-pdf-at-point-and-exit)

New contributor
user38601 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
10
  • Try doing M-x toggle-debug-on-error and redoing the p. You should get a backtrace which you should add to your question. That will give much more information about what is going on and limit the number of wrong turns that we might make.
    – NickD
    Aug 5 at 14:52
  • Thanks, I have added the error message
    – user38601
    Aug 5 at 20:32
  • It's better to add text than a screenshot (also easier for you to edit your user name out, rather than firing up an image editor - and easier for me to cut-and-paste from). What happens when you say open /path/to/some/file.pdf on the command line? Is this on a MacOSX system?
    – NickD
    Aug 5 at 20:47
  • BTW, it's complaining about the command open, not about the PDF file.
    – NickD
    Aug 5 at 20:52
  • 1
    Thanks, I got it to work with evince. I guess there is no command called open in ubuntu and xdg-open works but it shuts down the pdf right away so evince was the only one that worked.
    – user38601
    Aug 5 at 21:25

0

Your Answer

user38601 is a new contributor. Be nice, and check out our Code of Conduct.

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

Browse other questions tagged or ask your own question.