From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Nosov Subject: Regression: org-translate-link doesn't work correctly in Org 8.3 Date: Wed, 19 Aug 2015 12:58:52 +0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0103defaff9122051da714c0 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZS091-0005Ou-N4 for emacs-orgmode@gnu.org; Wed, 19 Aug 2015 05:58:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZS090-0005o9-Iu for emacs-orgmode@gnu.org; Wed, 19 Aug 2015 05:58:55 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:32953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZS090-0005nI-9Y for emacs-orgmode@gnu.org; Wed, 19 Aug 2015 05:58:54 -0400 Received: by wijp15 with SMTP id p15so121985476wij.0 for ; Wed, 19 Aug 2015 02:58:52 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --089e0103defaff9122051da714c0 Content-Type: text/plain; charset=UTF-8 Hi! 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)) (progn (setq s (funcall org-link-translation-function (match-string 1 s) (match-string 2 s))) (concat (car s) ":" (cdr s))) 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 --089e0103defaff9122051da714c0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi!

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

In this package, toc-org, I use=C2=A0org-link-translation-fu= nction 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 v= ariable 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.= =C2=A0

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

(defu= n org-translate-link (s)
=C2=A0 "Tra= nslate a link string if a translation function has been defined."
=C2=A0 (if (and org-link-translation-function=
=C2=A0 (fboundp org-link-translation-function)
=C2=A0 (string-match "\\([a-zA-Z0-9]+\\):\\(.*\= \)" s))
=C2=A0 =C2=A0 =C2=A0 (progn<= /div>
(setq s (funcall org-link-translation-function
(match-string 1 s) (match-string 2 s)))
(concat (car s) ":" (cdr s)))
=C2=A0 =C2=A0 s))

Consider that we're trying to follow the lin= k [[#about][About]]

In Org 8.2= =C2=A0org-translate-link=C2=A0function is called with s equal to "this= file:#about". So, (string-match "\\([a-zA-Z0-9]+\\):\\(.*\\)"= ; s) returns true and the call to the function stored in org-link-translati= on-function follows.

In Org 8.3 org-translate-link=C2=A0function is ca= lled with s equal to simply "#about" (no "thisfile:" in= the beginning). Thus, the string-match call NEVER succeeds (because there&= #39;s no colon).

Please, let me know, what would be the solution to th= is issue.

--
Best regards,
=C2=A0 =C2=A0 =C2= =A0 =C2=A0Sergei Nosov
--089e0103defaff9122051da714c0--