Plug citations into `org-open-at-point'

* lisp/org.el (org-open-at-point): Follow citations and citation
references.
This commit is contained in:
Nicolas Goaziou 2021-04-19 22:16:41 +02:00
parent 2c2b720394
commit a20a3ad5f1

View file

@ -8955,9 +8955,10 @@ a link."
;; closest one. ;; closest one.
(org-element-lineage (org-element-lineage
(org-element-context) (org-element-context)
'(clock comment comment-block footnote-definition '(citation citation-reference clock comment comment-block
footnote-reference headline inline-src-block inlinetask footnote-definition footnote-reference headline
keyword link node-property planning src-block timestamp) inline-src-block inlinetask keyword link node-property
planning src-block timestamp)
t)) t))
(type (org-element-type context)) (type (org-element-type context))
(value (org-element-property :value context))) (value (org-element-property :value context)))
@ -8968,7 +8969,7 @@ a link."
((memq type '(comment comment-block node-property keyword)) ((memq type '(comment comment-block node-property keyword))
(call-interactively #'org-open-at-point-global)) (call-interactively #'org-open-at-point-global))
;; On a headline or an inlinetask, but not on a timestamp, ;; On a headline or an inlinetask, but not on a timestamp,
;; a link, a footnote reference. ;; a link, a footnote reference or a citation.
((memq type '(headline inlinetask)) ((memq type '(headline inlinetask))
(org-match-line org-complex-heading-regexp) (org-match-line org-complex-heading-regexp)
(let ((tags-beg (match-beginning 5)) (let ((tags-beg (match-beginning 5))
@ -9031,6 +9032,7 @@ a link."
((eq type 'inline-src-block) (org-babel-open-src-block-result)) ((eq type 'inline-src-block) (org-babel-open-src-block-result))
((eq type 'timestamp) (org-follow-timestamp-link)) ((eq type 'timestamp) (org-follow-timestamp-link))
((eq type 'link) (org-link-open context arg)) ((eq type 'link) (org-link-open context arg))
((memq type '(citation citation-reference)) (org-cite-follow context arg))
(t (user-error "No link found"))))) (t (user-error "No link found")))))
(run-hook-with-args 'org-follow-link-hook)) (run-hook-with-args 'org-follow-link-hook))