Rasmus <ras...@gmx.us> writes: > Thanks for the comments. I've attached a new version.
Thanks. > Nicolas Goaziou <m...@nicolasgoaziou.fr> 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,