On 2014-10-15, at 12:19, Nicolas Goaziou wrote: > Hello, > > Marcin Borkowski <mb...@wmi.amu.edu.pl> 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