> * lisp/org-src.el: (org-src-before-write-back-hook, > org-src-after-write-back-hook, org-edit-src-save, org-edit-src-exit): > Add two hook variables and run the hooks when writing back to the > source buffer.
You need to write individual changelog entries for each of these additions. Also, the specific hook that you added should precede the colon. For example: * lisp/org-src.el (org-src-before-write-back-hook): Content. (org-src-after-write-back-hook): Content (org-edit-src-save, org-edit-src-exit): Content If you have magit installed, "magit-generate-changelog" will create these entries for you. Then, all you will have to do is add descriptions for each entry. Please also pay attention to your line lengths. > * etc/ORG-NEWS: Add the change to news > --- > etc/ORG-NEWS | 5 +++++ > lisp/org-src.el | 20 ++++++++++++++++++++ > 2 files changed, 25 insertions(+) > > diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS > index b2859abd4..4101015c1 100644 > --- a/etc/ORG-NEWS > +++ b/etc/ORG-NEWS > @@ -299,6 +299,11 @@ Abnormal hook called when certain text is hidden during > fontification > (currently emphasis markers, link decoration and URL, sub/superscript > decoration). > > +*** New hooks ~org-src-before-write-back-hook~ and > ~org-src-after-write-back-hook~ > + > +Normal hooks called before and after the contents of an > +~org-edit-special~ buffer are written back to its source buffer. > + Your news entry needs more detail. Remember, this is where most users are going to learn about a change and decide if they should use it in their workflow. Specifically, please address why you added these hooks in the first place. An example usage of these hooks could also be good. > +(defcustom org-src-before-write-back-hook nil > + "Normal hook that is run before an edit buffer is saved to its source > buffer." > + :type 'hook > + :package-version '(Org . "10.0") > + :group 'org-edit-structure) > + This is a nit, but it still isn't exactly clear from this description where this hook will be run. Please make it clear that this hook is run in the edit buffer, not the original buffer, similar to the way you did for `org-src-after-write-back-hook'. >(defcustom org-src-after-write-back-hook nil > "Normal hook that is run after an edit buffer is saved to its source buffer. > >The hook runs in the edit buffer if it still exists after writing >back. In particular, the hook does not run on `org-edit-src-exit', which >kills the edit buffer." Please add another space before "In particular". Le mar. 10 nov. 2026 à 08:12, Marten Lienen <[email protected]> a écrit : > > 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
