From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Borkowski Subject: How to "initiate" Org mode in a buffer Date: Fri, 10 Oct 2014 02:51:05 +0200 Message-ID: <87k348karq.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]:42458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcOQQ-0005Ss-Sn for emacs-orgmode@gnu.org; Thu, 09 Oct 2014 20:51:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XcOQL-0005h5-7a for emacs-orgmode@gnu.org; Thu, 09 Oct 2014 20:51:18 -0400 Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:53108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcOQL-0005gx-0n for emacs-orgmode@gnu.org; Thu, 09 Oct 2014 20:51:13 -0400 Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 4FD0C5B84B for ; Fri, 10 Oct 2014 02:51:12 +0200 (CEST) Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qibVRmZiGju3 for ; Fri, 10 Oct 2014 02:51:12 +0200 (CEST) Received: from localhost (111-128.echostar.pl [213.156.111.128]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id 1E3A25B846 for ; Fri, 10 Oct 2014 02:51:12 +0200 (CEST) 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: Org Mode Mailing List Hi list, I'm writing a function which does some (serious) modifications on an Org file. I want it to save the results in some new file, so I'm (most probably) going to create a new buffer, execute (org-mode) there, copy the contents of the old one (insert-buffer-substring?) and then do my stuff. However, "my stuff" depends on the (org) structure. Is there something I should call /before/ I do (org-element-parse-buffer)? I want to do something like (org-element-map (org-element-parse-buffer) '(headline) #'my-stuff) Is that going to work reliably (on a newly-created buffer)? TIA, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Adam Mickiewicz University