0

I want to create an org file with source blocks of different types and tangle those in a single file (order is important, of course):

#+PROPERTY: header-args  :tangle test.j2

#+begin_src conf-unix
 var1 = a
#+end_src

#+begin_src jinja2 
{% include 'file1' %}
#+end_src 

#+begin_src conf-unix
 var2 = b
#+end_src

However, I get:

var1 = a

var2 = b

{% include 'file1' %}

It seems like org-mode collects blocks in alphabetical order by type and only then in the order they were encountered in the org file. It does not cause problems when there is only a single type of source blocks, but if there are many, that behavior is certainly not intuitive. Is it a bug or a feature of org-mode?

3
  • I cannot reproduce this with upstream Org mode (updated as of 2023-06-23) but I also cannot reproduce it with Emacs 28 (with built-in Org mode, version 9.5.5). Does conf-unix or jinja2 appear in your org-babel-load-languages variable? What version of Org mode are you running?
    – NickD
    Jun 26, 2023 at 3:01
  • 1
    org-babel-load-languages’s value is ((shell . t)) Emacs 27.2 with built-in Org version 9.4. Updated to Org 9.6.6 (it wasn't easy because of org-assert-version error), now it works as intended. So it was a bug after all.
    – ivgrand
    Jun 26, 2023 at 16:14
  • Yes, that org-assert-version was (and is) a PITA. I ran into it trying to figure out an answer to this question but I haven't had a chance to get back to that. There has been some extensive discussion about it on both the Org mode list and the Emacs devel list, but I haven't had time to go through it.
    – NickD
    Jun 26, 2023 at 17:17

1 Answer 1

0

Yes, it's a bug. Upgrade Org. Version 9.6.6 seemingly works as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.