bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Lars Ingebrigtsen
Subject: bug#42483: 26.1: thing-at-point doesn't recognize org-link urls
Date: Fri, 22 Jan 2021 20:51:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Boruch Baum <boruch_baum@gmx.com> writes:

> 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))))

This sounds like something that belongs in org, though, and not in
thingatpt.el, though.  Unfortunately, thing-at-point doesn't have a
mode-based model for working...  but it could grow one?  That is, there
could be a buffer-local thing-at-point-local-things, and Org could set
that to

((url . org--org-url-at-point))

or something like that.

Any opinions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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