[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ANN] lisp/ob-tangle-sync.el
From: |
Ihor Radchenko |
Subject: |
Re: [ANN] lisp/ob-tangle-sync.el |
Date: |
Thu, 27 Apr 2023 12:02:19 +0000 |
Mehmet Tekman <mtekman89@gmail.com> writes:
> I would like to contribute some a new library into org-mode, which
> performs automatic synchronization between tangled files and their
> org-mode source blocks via a global minor mode
> `org-babel-tangle-sync-mode' which uses the after-save-hook.
Thanks for your interest in contributing to Org mode!
> By activating =org-babel-tangle-sync-mode=, I can edit either of those
> buffers and every time that I save it would automatically update the
> other. If I add the header argument =:tangle-sync <action>= then I
> can specify an action of:
> - skip :: do nothing, just save the buffer, even if the sync mode is active
> - pull :: only pull changes from =~/.bashrc= into the Emacs_conf org-mode file
> - export :: only export changes from Emacs_conf to =~/.bashrc=, even if called
> from =~/.bashrc=
> - both :: (default) synchronize freely between tangled file and source block
> (the is also the nil value)
Do I understand correctly that your package is adding the following new
features:
1. Automatically manages balanced
`org-babel-tangle'/`org-babel-detangle' in Org sources and target
buffers.
2. Attempts to make more fine-grained tangling/detanging functionality
by controlling tangling behaviour on per-src-block basis (via
:tangle-sync skip/pull/export/both)
If so, I think that (2) probably belongs to the main babel code
(`org-babel-tangle' and `org-babel-detangle'). Since you are
contributing to Org directly, you are free to modify these functions as
you need.
Note that your current approach with `org-babel-tangle-sync-synchronize'
will give unexpected results when one edits multiple src blocks or the
corresponding tangled source in multiple places - the :tangle-sync value
is only checked at point and `org-babel-tangle'/`org-babel-detange' is
then called for the whole buffer, not just for the current code block.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>