#+TITLE: Sync Many Blocks #+PROPERTY: header-args :tangle /tmp/default_tangle.txt :comments yes * Default Tangle The =:tangle= target here is given by the ~PROPERTY~ header. It is made up of three parts which synchronize with the tangled destination file in 3 different ways as given below: ** File Contents *** Free Head #+begin_src conf This is some text that can be synced both ways #+end_src *** Pull Middle #+begin_src conf :tangle-sync import The middle text only retrieves from the default tangle file #+end_src *** Push tail #+begin_src conf :tangle-sync export This last piece of text only exports from the source org mode file. #+end_src * Desired Function When =org-babel-tangle= is called, only the [[Free Head]] and [[Push tail]] sections are tangled. The middle section in the tangled file is _skipped_. When =org-babel-detangle= is called, only the [[Pull Middle]] section is updated here. The other two sections are _skipped_. * Why skipped? The functions suffixes explicitly state a direction (=tangle= / =detangle=), and it's probably important that we retain this directionality. If we want to synchronize all blocks (i.e. import the middle section from the tangled file during =org-babel-tangle=, and export the head and tail sections during =org-babel-detangle=), then perhaps we set a specific custom variable =(setq org-babel-tangle-alwayssync t)=? Or, we create a specific function =org-babel-sync= (for lack of better name) which tangles/detangles in whatever desired direction the source block specifies.