branch: externals/ebdb
commit e1efb0200ac4cde39de22b8a0694696e9ff58794
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Add before-save-hook and after-save-hook
* ebdb.el (ebdb-before-save-hook, ebdb-after-save-hook): New hooks, as
options.
(ebdb-save): Run them.
---
ebdb.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/ebdb.el b/ebdb.el
index f7d03e7..9280474 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -359,6 +359,14 @@ anniversary date, and the sexp (as a string):
:group 'ebdb
:type 'hook)
+(defcustom ebdb-before-save-hook nil
+ "Hook run before saving all databases."
+ :type 'hook)
+
+(defcustom ebdb-after-save-hook nil
+ "Hook run after saving all databases."
+ :type 'hook)
+
(defvar ebdb-create-hook nil
"*Hook run each time a new EBDB record is created.
Run with one argument, the new record. This is called before the record is
@@ -5179,9 +5187,11 @@ additionally prompt to save each database individually."
;; TODO: Reimplement ebdb-remote-file, or otherwise do something
;; about that.
(when interactive
- (message "Saving the EBDB..."))
+ (message "Saving the EBDB..."))
+ (run-hooks 'ebdb-before-save-hook)
(dolist (s ebdb-db-list)
(ebdb-db-save s (eq interactive 4)))
+ (run-hooks 'ebdb-after-save-hook)
(when interactive
(message "Saving the EBDB... done")))