[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

links are not parsed in keyword context

From: Alan Schmitt
Subject: links are not parsed in keyword context
Date: Mon, 13 Apr 2020 10:27:34 +0200


If you consider the following line in an org file

#+begin_src org
#+FOO: http://alan.petitepomme.net/

then calling ~org-element-context~ returns

#+begin_src emacs-lisp
 (:key "FOO"
  :value "http://alan.petitepomme.net/";
  :begin 1
  :end 38
  :post-blank 1
  :post-affiliated 1
  :parent nil))

If the same link is in the body of the org file, one gets

#+begin_src emacs-lisp
 (:type "http"
  :path "//alan.petitepomme.net/"
  :format plain
  :raw-link "http://alan.petitepomme.net/";
  :application nil
  :search-option nil
  :begin 38
  :end 66
  :contents-begin nil
  :contents-end nil
  :post-blank 0
  :parent (paragraph
           (:begin 38
            :end 68
            :contents-begin 38
            :contents-end 67
            :post-blank 1
            :post-affiliated 38
            :parent nil))))

The link can still be opened in both cases using ~org-open-at-point~,
but it is a problem for org-ref that relies on the second format to
extract the link information (see
where the link is set to ~nil~ because there is no ~:path~ property).

I see that orgmode uses a workaround in ~org-return~ when
~org-return-follows-link~ is set to true, to detect if there is a link
using a regexp
#+begin_src emacs-link
((and org-return-follows-link
  (or (org-in-regexp org-ts-regexp-both nil t)
      (org-in-regexp org-tsr-regexp-both nil  t)
      (org-in-regexp org-any-link-re nil t)))
    (call-interactively #'org-open-at-point))

Could is be possible to parse a link in keyword context? Alternatively,
should I suggest org-ref uses an approach similar to the one in ~org-return~?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]