[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] fetching the description from a link string
From: |
Alan Schmitt |
Subject: |
Re: [O] fetching the description from a link string |
Date: |
Tue, 17 Nov 2015 15:58:38 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) |
On 2015-11-16 10:45, Rasmus <address@hidden> writes:
> Alan Schmitt <address@hidden> writes:
>
>> Hello,
>>
>> I cannot seem to find in org.el a function that will return the
>> description part of a link. I'm probably missing it … Could someone tell
>> me if such a function exists?
>
> org-element-context on a link will give you what you want. It lives in
> org-element, though.
>
> Something like this when point is on a link,
>
> (let ((e (org-element-context)))
> (buffer-substring-no-properties
> (org-element-property :contents-begin e)
> (org-element-property :contents-end e)))
Thank you for the suggestion. I'm already doing something similar:
#+begin_src emacs-lisp
(let ((link (org-store-link nil))
(name (org-element-property :raw-value (org-element-at-point))))
...)
#+end_src
For some reason I was under the impression that org-element might be
overkill for this, but it works well.
Thanks again,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated November 9, 2015, Mauna Loa Obs.): 399.06 ppm
signature.asc
Description: PGP signature