reddit / emacs

org babel noweb infinite loop

mahmooz · 2022-05-10 19:35
consider the following code blocks #+NAME: a #+begin_src python :noweb yes <<b>> a = b + 10 #+end_src #+NAME: b #+begin_src python :noweb yes b = 20 a = <<a>> #+end_src executing either code block would result in the following error in the minibuffer outline-next-heading: Variable binding depth exceeds max-specpdl-size which i assume is because org babel is stuck in an infinite loop of inserting the references in c++ we have header guards to deal with this problem, how do i deal with this in org babel?, i know this might seem impractical at first but the example i provided is obviously very simplified and you can encounter this problem in more practical cases
globalcandyamnesia · 2022-05-11 00:02
Circular references are a common problem in most programming languages and can usually be fixed by refactoring. Maybe you can splice common functionality into a separate block.
Phil-Hudson · 2022-05-11 13:56
I would focus on solving this at the Python level.