summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-01-15 18:35:05 +0100
committerLukas Fleischer <lfleischer@calcurse.org>2016-01-15 18:36:41 +0100
commitc3648f08c7099e4ef120c8ce33c40eb0352c5acd (patch)
treec984340046bc786aa8da2b3e8d0514614ea244e1 /src
parentcaee34449c1c8b2c8bf3049f34625db871e7d9dc (diff)
downloadcalcurse-c3648f08c7099e4ef120c8ce33c40eb0352c5acd.zip
Run pre-save and post-save hooks on reload
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r--src/io.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/io.c b/src/io.c
index 374f092..b0eca77 100644
--- a/src/io.c
+++ b/src/io.c
@@ -746,6 +746,14 @@ void io_reload_data(void)
io_save_todo(path_todo_backup);
io_save_mutex_unlock();
+ /*
+ * We do not directly write to the data files here;
+ * however, the external merge tool might incorporate
+ * changes from the backup file into the main data
+ * files.
+ */
+ run_hook("pre-save");
+
if (!io_files_equal(path_apts, path_apts_backup)) {
const char *arg_apts[] = { conf.mergetool,
path_apts,
@@ -764,6 +772,15 @@ void io_reload_data(void)
xfree(path_apts_backup);
xfree(path_todo_backup);
+
+ /*
+ * We do not directly write to the data files here;
+ * however, the external merge tool will likely have
+ * incorporated changes from the backup file into the
+ * main data files at this point.
+ */
+ run_hook("post-save");
+
break;
case 3:
/* FALLTHROUGH */