From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Nosov Subject: Re: Regression: org-translate-link doesn't work correctly in Org 8.3 Date: Wed, 19 Aug 2015 13:53:30 +0300 Message-ID: References: <87bne3mv78.fsf@gnu.org> <877fora7fz.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e011771a966681a051da7d86f Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZS0zt-0005eq-Im for emacs-orgmode@gnu.org; Wed, 19 Aug 2015 06:53:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZS0zs-0001Th-5m for emacs-orgmode@gnu.org; Wed, 19 Aug 2015 06:53:33 -0400 In-Reply-To: <877fora7fz.fsf@nicolasgoaziou.fr> 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: Bastien , Sergei Nosov , emacs-orgmode@gnu.org --089e011771a966681a051da7d86f Content-Type: text/plain; charset=UTF-8 > wild guess: what if you simply make the ":" optional like this: I believe, the preceding text should be made optional as well (i.e. + should be *, like (string-match "\\([a-zA-Z0-9]*\\):?\\(.*\\)" s)) But anyway, it doesn't seem to work, because for some reason (I just noticed this) - the org-translate-link function doesn't seem to be called at all, when C-c C-o is executed. It is called only in org-element-link-parser. Also, org-translate-link tries to return the link in the ":" format (exactly the way it expects the input parameter to be). So, simply modifying the regexp shouldn't work because of this as well. So, I suppose, something like what Nicolas suggests should be done about it (i.e. providing the type and the link in the "new format"). Also, org-translate-link should probably be called somewhere in org-open-at-point again. -- Best regards, Sergei Nosov On Wed, Aug 19, 2015 at 1:39 PM, Nicolas Goaziou wrote: > Hello, > > Bastien writes: > > > Hi Sergei, > > > > wild guess: what if you simply make the ":" optional like this: > > > > (string-match "\\([a-zA-Z0-9]+\\):\\(.*\\)" s) > > > > (string-match "\\([a-zA-Z0-9]+\\):?\\(.*\\)" s) > > ^^^ > > > > ? > > I think `org-translate-link' should be updated to provide correct type, > including internal ones, to `org-link-translation-function'. E.g., > > http://orgmode.org => "http" > #something => "custom-id" > (ref:line) => "coderef" > whatever => "fuzzy" > > At least, this would be consistent with the parser. > > Regards, > > -- > Nicolas Goaziou > --089e011771a966681a051da7d86f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
>=C2=A0wild guess: what if you simply make the ":" = optional like this:

I believe, the preceding text should b= e made optional as well (i.e. + should be *, like=C2=A0(string-match "\\([a-zA-Z0-9]*\\):?\= \(.*\\)" s))

<= /span>
But anyway, it doesn't seem to work, because for some reason (I = just noticed this) - the org-translate-link function doesn't seem to be= called at all, when C-c C-o is executed. It is called only in=C2=A0org-ele= ment-link-parser.=C2=A0

Also, org-translate-link tries to return the l= ink in the "<type>:<link>" format (exactly the way it= expects the input parameter to be). So, simply modifying the regexp should= n't work because of this as well.

So, I suppose, something like wh= at Nicolas suggests should be done about it (i.e. providing the type and th= e link in the "new format").

Also,=C2=A0org-translate-link s= hould probably be called somewhere in=C2=A0org-open-at-point again.


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

On Wed, Aug 19, 2015 at 1:39 PM, Nicolas Goa= ziou <mail@nicolasgoaziou.fr> wrote:
Hello,

Bastien <bzg@gnu.org> writes:

> Hi Sergei,
>
> wild guess: what if you simply make the ":" optional like th= is:
>
> (string-match "\\([a-zA-Z0-9]+\\):\\(.*\\)" s)
>
> (string-match "\\([a-zA-Z0-9]+\\):?\\(.*\\)" s)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^^^
>
> ?

I think `org-translate-link' should be updated to provide correc= t type,
including internal ones, to `org-link-translation-function'. E.g.,

=C2=A0 = http://orgmode.org =3D> "http"
=C2=A0 #something=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D> "custom-id&= quot;
=C2=A0 (ref:line)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D> "coderef&qu= ot;
=C2=A0 whatever=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D> "fuzzy= "

At least, this would be consistent with the parser.

Regards,

--
Nicolas Goaziou

--089e011771a966681a051da7d86f--