emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Q] How to programmatically get the description of a link?
@ 2021-08-13 23:10 Rodrigo Morales
  2021-08-14  0:04 ` John Kitchin
  0 siblings, 1 reply; 2+ messages in thread
From: Rodrigo Morales @ 2021-08-13 23:10 UTC (permalink / raw)
  To: emacs-orgmode


* The question

Let's say I have the following link

#+BEGIN_SRC org
This is a sentence [[foo][bar]]. This is another sentence.
#+END_SRC

How to programmatically get the description of the link (i.e. =bar=)?

* Additional information

I've tried using =org-element-context=. The following sexp was
executed when the cursor was on the link which was presented above.

#+BEGIN_SRC text
ELISP> (with-current-buffer "main.org" (org-element-context))
#+END_SRC

#+BEGIN_SRC text
(link
 (:type "fuzzy" :path "foo" :format bracket :raw-link "foo" :application nil :search-option nil :begin 1 :end 15 :contents-begin 8 :contents-end 13 :post-blank 0 :parent
        (paragraph
         (:begin 1 :end 16 :contents-begin 1 :contents-end 16 :post-blank 0 :post-affiliated 1 :parent nil))))
#+END_SRC

and =org-element-at-point=. The following sexp was executed when the
cursor was on the link which was presented above.

#+BEGIN_SRC text
ELISP> (with-current-buffer "main.org" (org-element-at-point))
#+END_SRC

#+BEGIN_SRC text
(paragraph
 (:begin 1 :end 16 :contents-begin 1 :contents-end 16 :post-blank 0 :post-affiliated 1 :parent nil))
#+END_SRC

but neither of those get the description of the link as metadata.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-14  0:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 23:10 [Q] How to programmatically get the description of a link? Rodrigo Morales
2021-08-14  0:04 ` John Kitchin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).