> "Marten Lienen" <[email protected]> writes: > > >> Sure. What I meant is that the new hook can be run inside > >> `org-src--contents-for-write-back-1'. > > > > That makes sense. Does that mean that you think it should be an abnormal > > hook that gets and returns a content string? > > It might either do edits in current buffer or return a value. > I think edits is more efficient, but, as I said, I did not read this > thread in details, so I will let Earl continue the review.
I agree with Ihor on this. Running a normal hook inside `org-src--contents-for-write-back-1' means you don't have to add your new `org-src-before-write-back-hook' to `org-edit-src-save' and `org-edit-src-exit'. That also means your hook would have to respect the value of org-src--allow-write-back. Currently, `org-src-before-write-back-hook' is called whether or not a write-back buffer will actually be created. This means that an `org-edit-src-abort' call will trigger a call to your hook, even though `org-edit-src-abort' sets `org-src--allow-write-back' to false.
