From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [bug, patch, ox] INCLUDE and footnotes Date: Mon, 22 Dec 2014 00:38:26 +0100 Message-ID: <878ui0y3nx.fsf@nicolasgoaziou.fr> References: <87h9x5hwso.fsf@gmx.us> <87oarcbppe.fsf@nicolasgoaziou.fr> <87fvcozfhf.fsf@gmx.us> <87h9x4bj33.fsf@nicolasgoaziou.fr> <87iohks4ne.fsf@gmx.us> <87d27rbvio.fsf@nicolasgoaziou.fr> <87bnnbhg2x.fsf@gmx.us> <878uifbjc7.fsf@nicolasgoaziou.fr> <87388j9qbv.fsf@gmx.us> <87y4q57t2i.fsf@nicolasgoaziou.fr> <87lhm4n9ky.fsf@pank.eu> <87y4q3a8tc.fsf@pank.eu> <87d27cyas6.fsf@nicolasgoaziou.fr> <878ui039wv.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2q48-00038x-Fz for emacs-orgmode@gnu.org; Sun, 21 Dec 2014 18:37:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y2q41-0005eA-Nc for emacs-orgmode@gnu.org; Sun, 21 Dec 2014 18:37:36 -0500 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]:33746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2q41-0005dF-HQ for emacs-orgmode@gnu.org; Sun, 21 Dec 2014 18:37:29 -0500 In-Reply-To: <878ui039wv.fsf@gmx.us> (rasmus@gmx.us's message of "Sun, 21 Dec 2014 23:39:12 +0100") 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: Rasmus Cc: emacs-orgmode@gnu.org Rasmus writes: > Thanks for the comments. I've attached a new version. Thanks. > Nicolas Goaziou writes: >> This is not necessary. Even if :minlevel is used on these include >> keywords, its value is ignored when inserting contents of the file. > > It's not neural to the org export buffer, though it's probably neutral to > the *exported* document. > > E.g. > > (org-test-with-temp-text > (format "#+INCLUDE: \"%s/examples/include2.org\" src emacs-lisp" org-test-dir) > (org-export-expand-include-keyword) > (buffer-string)) > > => > > "#+BEGIN_src emacs-lisp :minlevel 1 > Success! > #+END_src > " > > Which is turn is passed to babel (which also seems to ignoring it). I > cannot easily condition on src (without using the previous complex regexp) > since the file "~/my src folder/FILE" is not totally unlikely... Indeed. This is not pretty. I forgot about that feature. I suggest to do it differently, then. We first process every include keyword in the document, but simply add a text property (e.g. `org-include-level') over them specifying (1+ (org-reduced-level (or (org-current-level) 0))) as their value. Later, instead of (minlevel (and (not env) (if (string-match ":minlevel +\\([0-9]+\\)" value) (prog1 (string-to-number (match-string 1 value)) (setq value (replace-match "" nil nil value))) (let ((cur (org-current-level))) (if cur (1+ (org-reduced-level cur)) 1))))) we can use (minlevel (and (not env) (if (string-match ":minlevel +\\([0-9]+\\)" value) (prog1 (string-to-number (match-string 1 value)) (setq value (replace-match "" nil nil value))) (get-text-property (point) 'org-include-level)))) Include lines are not modified and this variable only applies to Org documents. WDYT? Regards,