[Top][All Lists]

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

[O] Regression: org-translate-link doesn't work correctly in Org 8.3

From: Sergei Nosov
Subject: [O] Regression: org-translate-link doesn't work correctly in Org 8.3
Date: Wed, 19 Aug 2015 12:58:52 +0300


I'm the maintainer of the toc-org (https://github.com/snosov1/toc-org) package. With 8.3 I have noticed a regression in how org-translate-link function works.

In this package, toc-org, I use org-link-translation-function variable to make C-c C-o (org-open-at-point) work with GitHub-style links. To do this, I set the aforementioned org-link-translation-function variable to a function that translates GitHub-style links back to Org-style.

It was working fine in Org 8.2, but it doesn't work in Org 8.3. 

I believe the root cause is the following. Here's the code of the org-translate-link function:

(defun org-translate-link (s)
  "Translate a link string if a translation function has been defined."
  (if (and org-link-translation-function
  (fboundp org-link-translation-function)
  (string-match "\\([a-zA-Z0-9]+\\):\\(.*\\)" s))
(setq s (funcall org-link-translation-function
(match-string 1 s) (match-string 2 s)))
(concat (car s) ":" (cdr s)))

Consider that we're trying to follow the link [[#about][About]]

In Org 8.2 org-translate-link function is called with s equal to "thisfile:#about". So, (string-match "\\([a-zA-Z0-9]+\\):\\(.*\\)" s) returns true and the call to the function stored in org-link-translation-function follows.

In Org 8.3 org-translate-link function is called with s equal to simply "#about" (no "thisfile:" in the beginning). Thus, the string-match call NEVER succeeds (because there's no colon).

Please, let me know, what would be the solution to this issue.

Best regards,
       Sergei Nosov

reply via email to

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