Run pre-save and post-save hooks on reload

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lukas Fleischer 2016-01-15 18:35:05 +01:00
parent caee34449c
commit c3648f08c7

View File

@ -746,6 +746,14 @@ void io_reload_data(void)
io_save_todo(path_todo_backup); io_save_todo(path_todo_backup);
io_save_mutex_unlock(); 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)) { if (!io_files_equal(path_apts, path_apts_backup)) {
const char *arg_apts[] = { conf.mergetool, const char *arg_apts[] = { conf.mergetool,
path_apts, path_apts,
@ -764,6 +772,15 @@ void io_reload_data(void)
xfree(path_apts_backup); xfree(path_apts_backup);
xfree(path_todo_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; break;
case 3: case 3:
/* FALLTHROUGH */ /* FALLTHROUGH */