org-tanglesync.el
org-tanglesync.el copied to clipboard
Handle :noweb and :shebang
Handling :noweb and :shebang
So a block with :noweb ref or a :shebang
#+BEGIN_SRC sh :noweb-ref sh-bashrc :noweb-sep "\n"
[ -r $HOME/.config/sh/xdg.sh ] && . $HOME/.config/sh/xdg.sh
[ -r $HOME/.config/sh/env.sh ] && . $HOME/.config/sh/env.sh
#+END_SRC
#+BEGIN_SRC sh :tangle sh/.bashrc :shebang "#!/bin/bash\n"
# Source installed interactive shell configurations:
<<sh-bashrc>>
#+END_SRC
will be tangled to
#!/bin/sh
# Source installed login shell configurations:
[ -r $HOME/.config/sh/xdg.sh ] && . $HOME/.config/sh/xdg.sh
[ -r $HOME/.config/sh/env.sh ] && . $HOME/.config/sh/env.sh
But the sync will be back and remove the <<sha-bashrc>> and even add a new shebang at ever synchronisation and end like this:
#+BEGIN_SRC sh :noweb-ref sh-bashrc :noweb-sep "\n"
[ -r $HOME/.config/sh/xdg.sh ] && . $HOME/.config/sh/xdg.sh
[ -r $HOME/.config/sh/env.sh ] && . $HOME/.config/sh/env.sh
#+END_SRC
#+BEGIN_SRC sh :tangle sh/.bashrc :shebang "#!/bin/bash\n"
#!/bin/sh
#!/bin/sh
# Source installed login shell configurations:
[ -r $HOME/.config/sh/xdg.sh ] && . $HOME/.config/sh/xdg.sh
[ -r $HOME/.config/sh/env.sh ] && . $HOME/.config/sh/env.sh
#+END_SRC
Im pretty sure it wont be doable but its just to be exhaustive about what the org-tanglesync could support (In a dreamed version).
Good spot, and thanks for testing this.
I will likely not implement a fix since it's far beyond my capabilities to handle no-web stuff, but I will write up in the README the limitations of the project