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 identify multiple links #209

Closed
randomwangran opened this issue Mar 25, 2022 · 1 comment
Closed

[citation] link cannot identify multiple links #209

randomwangran opened this issue Mar 25, 2022 · 1 comment

Comments

@randomwangran
Copy link

If the citation has a format like this:

link-hint-open-link can only identify the =citation= as one link.

image

However, if the cursor is on a different key, the open command will result in different things.

Condition 1:
image

Will open feynman2011feynman.

Condition 2:
image

Will open hutchings2018surely.

org-ref-next-key can identify the links in a finner level, so that
would be a good starting point.

@randomwangran
Copy link
Author

There is a function in org-ref-citation-link.el:

(defun org-ref-jump-to-visible-key ()
  "Jump to a visible key with avy."
  (interactive)
  (avy-with avy-goto-key
    (avy-process
     (apply #'append
            (save-excursion
              (org-element-map (org-element-parse-buffer) 'link
                (lambda (c)
                  (when (assoc (org-element-property :type c) org-ref-cite-types)
                    (goto-char (org-element-property :begin c))
                    (let* ((path (org-element-property :path c))
                           (data (org-ref-parse-cite-path path))
                           (references (plist-get data :references)))
                      (append (list (org-element-property :begin c))
                              (cl-loop for ref in references collect
                                       (progn
                                         (search-forward (plist-get ref :key))
                                         (match-beginning 0)))))))))))
    (avy--style-fn avy-style)))

So, the user can have finner control over the Dropping Zone (DZ).

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