emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sergei Nosov <sergei.nosov@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Regression: org-translate-link doesn't work correctly in Org 8.3
Date: Wed, 19 Aug 2015 12:58:52 +0300	[thread overview]
Message-ID: <CADi+Rs-CPLiuL1MCeM3nWva66RnYwStTRa+Qp0RNdbj-43ddxg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1563 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3832 bytes --]

             reply	other threads:[~2015-08-19  9:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19  9:58 Sergei Nosov [this message]
2015-08-19 10:25 ` Regression: org-translate-link doesn't work correctly in Org 8.3 Bastien
2015-08-19 10:39   ` Nicolas Goaziou
2015-08-19 10:53     ` Sergei Nosov
2015-08-19 10:55     ` Bastien
2015-08-19 13:28       ` Nicolas Goaziou
2015-08-19 13:55         ` Sergei Nosov
2015-08-21 12:11           ` Nicolas Goaziou
2015-08-21 12:48             ` Sergei Nosov
2015-08-21 13:04               ` Nicolas Goaziou
2015-08-21 18:44                 ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADi+Rs-CPLiuL1MCeM3nWva66RnYwStTRa+Qp0RNdbj-43ddxg@mail.gmail.com \
    --to=sergei.nosov@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).