[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/edit-indirect 2fc8f382ee 19/28: Add before-commit-hook
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/edit-indirect 2fc8f382ee 19/28: Add before-commit-hook |
Date: |
Thu, 7 Jul 2022 11:59:14 -0400 (EDT) |
branch: elpa/edit-indirect
commit 2fc8f382ee12fc8f7202288534258186bdf6068a
Author: Joost Diepenmaat <joost@zeekat.nl>
Commit: Fanael Linithien <fanael4@gmail.com>
Add before-commit-hook
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).
---
edit-indirect.el | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/edit-indirect.el b/edit-indirect.el
index 28b4a2e275..569e2adcd6 100644
--- a/edit-indirect.el
+++ b/edit-indirect.el
@@ -63,6 +63,16 @@ Note that the buffer-local value from the parent buffer is
used."
:type 'hook
:group 'edit-indirect)
+(defcustom edit-indirect-before-commit-hook nil
+ "Functions called before the edit-indirect buffer is committed.
+The functions are called with the edit-indirect buffer as the
+current buffer.
+
+Note that the buffer-local value from the edit-indirect buffer is
+used."
+ :type 'hook
+ :group 'edit-indirect)
+
(defcustom edit-indirect-before-commit-functions nil
"Functions called before an edit-indirect buffer is committed.
The functions are called with the parent buffer as the current
@@ -296,6 +306,7 @@ No error is signaled if `inhibit-read-only' or
(defun edit-indirect--commit ()
"Commit the modifications done in an edit-indirect buffer."
+ (run-hooks 'edit-indirect-before-commit-hook)
(let ((beg (overlay-start edit-indirect--overlay))
(end (overlay-end edit-indirect--overlay))
(buffer (current-buffer))
- [nongnu] branch elpa/edit-indirect created (now f80f63822f), ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 1d0cabfbe7 02/28: Clarify how this package differs from clone-indirect-buffer., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 56e3231915 01/28: Initial import., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect ac56a2ff8d 03/28: Add C-c C-c binding for edit-indirect-commit., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect e01e7eeb79 04/28: Extract a nested let into a function., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 273910a944 11/28: Ensure commit hooks are always called with the correct region., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 215d3a714a 16/28: Release version 0.1.3, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect de645d8144 21/28: Add edit-indirect-save function and keybinding, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 2fc8f382ee 19/28: Add before-commit-hook,
ELPA Syncer <=
- [nongnu] elpa/edit-indirect bdc8f542fe 23/28: Don't run buffer-local after-creation-hook twice, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect f80f63822f 28/28: Make edit-indirect--should-quit-window persistent, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 03b6ac9ed1 25/28: Use a remap binding for save-buffer instead of hardcoded C-x C-s, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 7fffd87ac3 24/28: Don't modify buffer if nothing changed, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 16bcdbdae6 27/28: Add an overlay keymap for easy switching to active edit-indirect buffers, ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect b461e559e1 05/28: Don't retrieve the buffer-local hook values before actual uses., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 7d9bcfced3 06/28: Extract buffer-local value handling into a macro., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect 6fa78ff6f1 07/28: Prohibit modification at the beginning of the overlay., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect f43936b3a4 12/28: Use `quit-window' instead of `kill-buffer-and-window`., ELPA Syncer, 2022/07/07
- [nongnu] elpa/edit-indirect d1ab87fdfb 14/28: Release version 0.1.2., ELPA Syncer, 2022/07/07