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

[citation] link cannot open properly #208

Open
randomwangran opened this issue Mar 25, 2022 · 0 comments
Open

[citation] link cannot open properly #208

randomwangran opened this issue Mar 25, 2022 · 0 comments

Comments

@randomwangran
Copy link

If the point is not under a cite link, link-hint-open-link can open a
link cite:somekey, which will result in the following hydra command
panel org-ref-citation-hydra/body It is a function in
org-ref/org-ref-citation-links.el.

image

However, further input from the user will result in a failed message:
Wrong type argument: stringp, nil. For example, pressing p will result in
a message: Wrong type argument: stringp, nil.

Here's my initial investigation.

Taking open an pdf as example. In the following function,
org-ref-citation-hydra/org-ref-open-pdf-at-point-and-exit

(defun org-ref-open-pdf-at-point ()
  "Open the pdf for bibtex key under point if it exists."
  (interactive)
  (let* ((bibtex-completion-bibliography (org-ref-find-bibliography))
         (results (org-ref-get-bibtex-key-and-file))
         (key (car results))
         (pdf-file (bibtex-completion-find-pdf key t)))
    (pcase (length pdf-file)
      (0
       (message "no pdf found for %s" key))
      (1
       (org-open-file (car pdf-file)))
      (_
       (org-open-file (completing-read "pdf: " pdf-file))))))

(org-ref-get-bibtex-key-and-file) use the the value returned by
(org-ref-get-bibtex-key-under-cursor) to get key and pdf file. If the
cursor is not under the citation link, then there is no result
returned, which will cause the error message. However, if the cursor
is on the citation link, the pdfs will be opened properly.

I am trying to figure out how to pass the key to org-ref-open-pdf-at-point.

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

1 participant