From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: How to change a link? Date: Wed, 15 Oct 2014 09:16:20 +0200 Message-ID: <87zjcxzttn.fsf@gmail.com> References: <87a94yjia9.fsf@wmi.amu.edu.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeIp6-0007N5-UM for emacs-orgmode@gnu.org; Wed, 15 Oct 2014 03:16:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeIp1-0000Wv-Dg for emacs-orgmode@gnu.org; Wed, 15 Oct 2014 03:16:40 -0400 Received: from plane.gmane.org ([80.91.229.3]:40172) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeIp1-0000Wp-7b for emacs-orgmode@gnu.org; Wed, 15 Oct 2014 03:16:35 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XeIoz-0005mA-Jc for emacs-orgmode@gnu.org; Wed, 15 Oct 2014 09:16:33 +0200 Received: from g231111120.adsl.alicedsl.de ([92.231.111.120]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 15 Oct 2014 09:16:33 +0200 Received: from tjolitz by g231111120.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 15 Oct 2014 09:16:33 +0200 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 Marcin Borkowski writes: > Hi list, > > 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 > 2. if it is, change it so that it points to the analogous place in > another file. > > Any hints about how to do these things? > > (The rationale is that I'm writing a function which splits a single Org > file into a bunch of smaller ones, and I want to preserve links.) [[http:www.orgmode.org][Org-mode]] #+BEGIN_SRC emacs-lisp :results raw (save-excursion (re-search-backward org-link-re-with-space) (goto-char (match-beginning 0)) (org-dp-contents (org-element-at-point))) #+END_SRC #+results: ((link (:type "http" :path "www.orgmode.org" :raw-link "http:www.orgmode.org" :application nil :search-option nil :begin 609 :end 643 :contents-begin 633 :contents-end 641 :post-blank 0 :parent ...))) so these ,---- | :type "http" :path "www.orgmode.org" :raw-link "http:www.orgmode.org" `---- are your candidates for getting and setting with 'org-element-property' and 'org-element-put-property'. -- cheers, Thorsten