Is there a function in elisp that will return the description of an internal org-mode link?

I would want this to work for any type of supported link:




  • 1
    org-open-at-point has some goodies (inside) that you may wish to look at -- i.e., M-x find-function ... I tend to avoid most org-mode questions directly nowadays because everyone has a different version and the library is under constant development.
    – lawlist
    Jan 23, 2018 at 2:31

3 Answers 3


I guess you want something like:

(defun get-description-at-point ()
  (let ((link (org-element-context)))
    (message "%s" (buffer-substring (org-element-property :contents-begin link)
                                    (org-element-property :contents-end link)))))
  • 1
    The command behaves differently depending on whether it is invoked interactively or programmatically. I managed to make its behavior consistent by replacing buffer-substring with buffer-substring-no-properties.
    – Pablo
    Oct 14, 2021 at 22:27

There exists (org-link-display-format s), which replaces all links in s with there description.

For your case you than just need to add the brackets where you want them:

(concat "[[" (org-link-display-format "[[link][description]]") "]]")
  • Thank you! This seems like the sanest answer.
    – Beetle B.
    Mar 31, 2023 at 23:36
  • Works like a charm! Thanks!
    – zeit
    Oct 12, 2023 at 9:26

You can also use regex to extract the link description:

(replace-regexp-in-string "\\(\\[\\[.*\\]\\[\\)\\(.*\\)\\]\\]" "[[\\2]]" "[[link][description]]")

will return [[description]]. If you omit the opening and closing braces in the second argument (that is, \\2), you will get description.

Note: I'm just beginning to use regex, so perhaps there are better solutions to set up the regex.

  • replace-regex-in-string -> replace-regexp-in-string
    – Hatshepsut
    Jul 8, 2018 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.