The attached patch adds to new hooks: ~org-src-before-write-back-hook~ and ~org-src-after-write-back-hook~. These let the user process the buffer contents before saving, for example to restore and re-expand expanded Elisp macros when saving an Elisp source block. Without this patch, there is no way to hook into the process (except for advice or similar of course) and in the macrostep example, ~org-src-edit-save~ would write the expanded macro back to the source buffer.
At the moment, ~org-src-edit-exit~ kills the edit buffer before writing back to the source buffer. Therefore, ~org-src-after-write-back-hook~ is only run by ~org-src-edit-save~. At first, I wanted to call these ~*-before/after-save-hook~ in analogy to the standard Emacs hooks, but settled on the current names to avoid conflicts with auto-saving, which actually saved the edit buffer into a file. Best, Marten
0001-org-src-Add-before-and-after-hooks-for-writing-back.patch
Description: Binary data
