Karl Fogel <kfo...@red-bean.com> writes: > I admit that I don't immediately understand why this is a good > thing. The user asked for the bounds of the URL at point, but got > instead the bounds of some other thing (the Org "node"). > Especially in the case of a standalone URL, with no description > text, I don't see how including the whitespace is useful. > > However, there could be issues here that I'm not familiar with. > It sounds like you've already thought this out and concluded that > that including the trailing whitespace is the right behavior. If > you have time to explain why in more detail, I'd appreciate a > chance to learn more about it. However, if you don't have time to > do that, it's no problem.
The notion of "URL", and especially "URL at point" in Org mode needs to be special. Consider something like [[https://orgmode.org][this is a very long and /convoluted/ description of this url; all the text here is clickable as a link]]. Org mode will consider point anywhere inside the link as "at URL". That "URL" will be https://orgmode.org, and it is indeed what (thing-at-point 'url) will return on that link in Org mode, even when point is on the link description. Hope it makes sense. What does not make sense in such scenario is returning (bounds-of-thing-at-point 'url) to not include point. So, we instead return the relevant syntax object - link object. And that object includes description, brackets, and whitespace after. There is no reason to make plain links special in this regard, so we don't. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>