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

Previous Next

Package: org-mode;

Reported by: Boruch Baum <boruch_baum <at> gmx.com>

Date: Thu, 23 Jul 2020 03:33:01 UTC

Severity: wishlist

Tags: moreinfo

Full log


Message #10 received at 42483 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Boruch Baum <boruch_baum <at> gmx.com>
Cc: 42483 <at> debbugs.gnu.org
Subject: Re: bug#42483: 26.1: thing-at-point doesn't recognize org-link urls
Date: Fri, 22 Jan 2021 20:51:18 +0100
Boruch Baum <boruch_baum <at> 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




This bug report was last modified 3 years and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.