Fanael / edit-indirect

Edit regions in separate buffers
99 stars 23 forks source link

Add before-commit-hook #4

Closed joodie closed 7 years ago

joodie commented 7 years ago

Provide a hook to be called before committing changes with the edit-indirect buffer as the current buffer. Will be called before the edit-indirect-before-commit-functions hook.

This provides the necessary symmetry for doing per-edit custom hooks; in an edit-indirect-after-create-hook you can add a buffer-local edit-indirect-before-commit-hook, which will then be called only when the then-active edit is comitted. You cannot use edit-indirect-before-commit-functions for that since that hook is called from the parent buffer (so it will apply to any edit committed to the parent buffer).

joodie commented 7 years ago

The reason I'm requesting this change is that I need something like it to implement literal-string-mode in terms of edit-indirect.

See https://github.com/joodie/literal-string-mode/tree/edit-indirect

Fanael commented 7 years ago

Thanks!