From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Extract item body with drawers/properties Date: Tue, 08 May 2012 11:53:10 +0200 Message-ID: <87r4uvvw1l.fsf@gnu.org> References: <4FA6FB29.2060204@grierwhite.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:34089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRh5e-00047P-Iv for emacs-orgmode@gnu.org; Tue, 08 May 2012 05:52:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRh5c-0003QY-DH for emacs-orgmode@gnu.org; Tue, 08 May 2012 05:52:18 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:51477) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRh5c-0003QM-4D for emacs-orgmode@gnu.org; Tue, 08 May 2012 05:52:16 -0400 Received: by were53 with SMTP id e53so348206wer.0 for ; Tue, 08 May 2012 02:52:14 -0700 (PDT) In-Reply-To: <4FA6FB29.2060204@grierwhite.com> (Christopher J. White's message of "Sun, 06 May 2012 18:28:57 -0400") 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: "Christopher J. White" Cc: emacs-orgmode@gnu.org Hi Christopher, "Christopher J. White" writes: > Is there a function to extract the body of an item minus all the auxiliary > information? Yes -- see org-element.el in contrib/lisp/ and ̀org-element-parse-buffer' as a starting point. Nicolas might give further directions on how to get the body text only. > * Item > This is the text I want. > And here is the second line. > SCHEDULED: <2012-05-12> > DEADLINE: <2012-05-13> Please put SCHEDULED: <2012-05-12> and DEADLINE: <2012-05-13> on the line right after the headline "Item". It will produce unexpected results on some commands right now. > :PROPERTIES: > :foo: bar > :END: I would also recommend putting this right below the SCHEDULED/DEADLINE line. > And it's conceivable there is more below drawers... > ** Sub-Item 1 > ** Sub-Item 2 > Basically I want a function that does the following: > > (org-entry-get-text) > "This is the text I want > And here is the second line. > And it's conceivable there is more below drawers..." There is `org-agenda-get-some-entry-text' but you don't want to look at it... because it's tuned for use in agenda only. > Point is at "* Item" when this is called. > > For one project (org-toodledo), I coded a version (see below) that pulls > out the drawers, drops properties SCHEDULED/DEADLINE/CLOSED, and pulls off > any indentation, and it works pretty well, although it is probably not > complete for all cases. However, I'm now working on extensions for another > project (org-taskjuggler) and want to again pull out the note. > > I tried again to find such a function in the org source files, but I just > can't seem to find it. > > Does it exist? Not yet -- but building one from org-element.el is possible. > If not, does it make sense to make my version below > workable for org-mode developers in general? Please have a look at what Aurélien is working on right now: http://orgmode.org/w/org-sync.git The purpose is exactly this: build a gateway between Org and external services like toodledo. There is no support for toodledo service in Aurélien's code for now, but I think there will be when he will be done. You might also be interested in org-x: http://thread.gmane.org/gmane.emacs.orgmode/45570 AFAIU, org-x ignores the content of a subtree, so this will not help you that much -- but the idea of connecting Org with external services is there. > (Related, what is the right term for this block of text? Note? Content? > Text?) I'd call this the "contents" of a section. Note the plural form, as each section can contain paragraphs, code snippets, etc. HTH, -- Bastien