[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] How to change a link?
From: |
Marcin Borkowski |
Subject: |
Re: [O] How to change a link? |
Date: |
Wed, 15 Oct 2014 23:30:11 +0200 |
On 2014-10-15, at 12:19, Nicolas Goaziou wrote:
> Hello,
>
> Marcin Borkowski <address@hidden> writes:
>
>> assume that I have a link object (e.g., I'm in the ellipsis part of
>> this:
>>
>> (org-element-map (org-element-parse-buffer 'object) 'link
>> (lambda (elt) ... ))
>>
>> What I want to do is this:
>> 1. check whether it is an internal link, and
>
> (member (org-element-property :type elt) '("custom-id" "fuzzy"))
>
>> 2. if it is, change it so that it points to the analogous place in
>> another file.
>
> (org-element-put-property elt :raw-link
> (concat "file:path/to/other-file.org::"
> (org-element-property :path elt)))
Thanks a lot, that was helpful! I'm starting to feel more and more
confident with org-element-whatever, that's good.
I have one more question. What I'm about to do is (basically) put
"file:some-file-name::" in front of the link, without changing the
description. I could use `org-element-put-property' and (AFAIU)
org-element-link-interpreter to put it into the buffer (and probably
delete the old one). It would be much easier (and maybe faster) just to
go to the point in the buffer where the link starts, go `(forward-char
2)' (past the brackets) and `(insert (concat "file" name "::"))'.
But, is it safe? Wouldn't it break something? And is it considered a
good practice?
Regards,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University
- [O] How to change a link?, Marcin Borkowski, 2014/10/14
- Re: [O] How to change a link?, Thorsten Jolitz, 2014/10/15
- Re: [O] How to change a link?, Marcin Borkowski, 2014/10/15
- Re: [O] How to change a link?, Thorsten Jolitz, 2014/10/15
- Re: [O] How to change a link?, Marcin Borkowski, 2014/10/15
- Re: [O] How to change a link?, Thorsten Jolitz, 2014/10/15
- Re: [O] How to change a link?, Marcin Borkowski, 2014/10/15
- Re: [O] How to change a link?, Thorsten Jolitz, 2014/10/15
- Re: [O] How to change a link?, Thorsten Jolitz, 2014/10/15
- Re: [O] How to change a link?, Nicolas Goaziou, 2014/10/15
- Re: [O] How to change a link?,
Marcin Borkowski <=
- Re: [O] How to change a link?, Nicolas Goaziou, 2014/10/15
- Re: [O] How to change a link?, Marcin Borkowski, 2014/10/16
- Re: [O] How to change a link?, Nicolas Goaziou, 2014/10/16
- Re: [O] How to change a link?, Marcin Borkowski, 2014/10/16
- Re: [O] How to change a link?, Thorsten Jolitz, 2014/10/16
- Re: [O] How to change a link?, Marcin Borkowski, 2014/10/17
- Re: [O] How to change a link?, Nick Dokos, 2014/10/17
- Re: [O] How to change a link?, Thorsten Jolitz, 2014/10/18
- Re: [O] How to change a link?, Marcin Borkowski, 2014/10/17
- Re: [O] How to change a link?, Thorsten Jolitz, 2014/10/18