bug#42483: 26.1: thing-at-point doesn't recognize org-link urls

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

bug#42483: 26.1: thing-at-point doesn't recognize org-link urls

Boruch Baum
One of the features of function `thing-at-point' is recognition of urls,
so I expected it to be able to recognize org-link urls, but that isn't
the case. Here's an example that when yanked into an org-mode buffer
will display the underlined text 'SageMathCell', and when performing `C-c
C-o' (M-x org-open-at-point) will correctly open the url link. However,
`(thing-at-point 'url)' and `(thing-at-point-url-at-point)' evaluate to
NIL.

   [[https://sagecell.sagemath.org/][SageMathCell]]

I was expecting function `thing-at-point-url-at-point' to check if the
mode was org-mode, and if so, to try something like the following

(defun shamelessly-plagiarized-from-org-open-at-point ()
  (interactive)
      (let* ((context
              (org-element-lineage
                (org-element-context) '(link) t))
             (value (org-element-property :value context))
             (type (org-element-property :type context))
             (path (org-link-unescape (org-element-property :path context))))
  (message (concat type ":" path))))

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0