Ignacio Casso <ignacioca...@hotmail.com> writes:

>> A better approach could be using org-link-expand-abbrev. It is an API
>> function and should be forward-compatible.
>
> Do you mean something like this?
>
> (defun org-open-at-point-global ()
>     ...
>     (cond ((org-in-regexp org-link-any-re)
>          (org-link-open-from-string
>             (org-link-expand-abbrev (match-string-no-properties 0))))
>           ...))
>
> Right now that is not enough because `org-link-expand-abbrev' only works
> for links without square brackets, like "abbrev:suffix", and
> `org-link-any-re' matches links with square brackets, like
> "[[abbrev:suffix]]". That could be easily worked around in
> `org-open-at-point-global' but maybe it would be better to change
> `org-link-expand-abbrev' to work with both forms.

Fair point. Then, the most future-proof way would be calling
org-element-link-parser. It should take care about abbrev expansion and
other edge cases. Then, you just need to use :raw-link property of the
parsed link element.

Best,
Ihor

Reply via email to