From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Export filters question Date: Mon, 15 Sep 2014 18:30:05 +0200 Message-ID: <8738bslxnx.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTZ9g-0007hq-4E for emacs-orgmode@gnu.org; Mon, 15 Sep 2014 12:29:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTZ9V-00032Q-PZ for emacs-orgmode@gnu.org; Mon, 15 Sep 2014 12:29:32 -0400 Received: from relay6-d.mail.gandi.net ([2001:4b98:c:538::198]:40586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTZ9V-00032H-JO for emacs-orgmode@gnu.org; Mon, 15 Sep 2014 12:29:21 -0400 In-Reply-To: (Fabrice Popineau's message of "Mon, 15 Sep 2014 14:01:00 +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: Fabrice Popineau Cc: "emacs-orgmode@gnu.org" Hello, Fabrice Popineau writes: > This is probably a very basic question, > but what is the right way to access properties of the element in a filter ? > > Admit I want to define my own filter: > > (defun my-latex-filter-headline (text backend info) > ... ) > > And I want to access the relative level of the current headline. How should > I do it? Short answer. You can't. Long answer. Actually, `info' contains the full parse tree (plist-get info :parse-tree) so you could be able to retrieve the headline currently being exported (since export results are cached in :exported-data, an untested idea would be to walk the tree with `org-element-map' and find the last headline without an entry in the cache). It is also probably bound to `data' per dynamic binding, but I wouldn't count on that as it might change in the future. Since filters are meant for tweaking generated output, the information you're looking after is not readily accessible at this level. Your request makes sense, but I think you really want to write a derived back-end with a custom headline transcoder instead. Regards, -- Nicolas Goaziou