From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Re: [PATCH] Allow property retrieval before first heading? Date: Sat, 12 Feb 2011 19:04:52 +0100 Message-ID: <87lj1lruwr.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=46828 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PoJpw-0004LJ-9q for emacs-orgmode@gnu.org; Sat, 12 Feb 2011 13:04:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PoJpu-0003pF-UM for emacs-orgmode@gnu.org; Sat, 12 Feb 2011 13:04:48 -0500 Received: from mail-bw0-f41.google.com ([209.85.214.41]:42244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PoJpu-0003ol-O0 for emacs-orgmode@gnu.org; Sat, 12 Feb 2011 13:04:46 -0500 Received: by bwz16 with SMTP id 16so4188527bwz.0 for ; Sat, 12 Feb 2011 10:04:45 -0800 (PST) In-Reply-To: (Dan Davison's message of "Sat, 12 Feb 2011 16:42:49 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Dan Davison Cc: emacs-orgmode@gnu.org Hi Dan, Dan Davison writes: > Dan Davison writes: > >> Currently (org-entry-get) throws an error if point is before the first >> heading. Is there a reason that this must be so? Org is too essential >> for headings to be obligatory! Thanks for the patch -- makes sense, I applied it. >> An example of when it would be useful to get properties is in a buffer >> containing src blocks but no headings (babel takes header args from Org >> properties). > > Hmm, for the record I was confused on that point; Eric already has a > workaround for the error to the effect that babel will take header args > from a #+PROPERTY line in a buffer with no headings. But my question > stands, as this error is a gotcha, requiring code like this > > (or (condition-case nil > (org-entry-get (point) header-arg t) > (error nil)) > (cdr (assoc header-arg org-file-properties)))) Yes - I removed a few useless condition-case wrapping since your patch. Please report any problem. Thanks, -- Bastien