From f555c00e0b0be14cd553c7c803d6136b86f2012b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 21 Nov 2016 23:32:28 +0100 Subject: vis-lua: pass path as second argument to file_save_post event hook The passed path can be different from file.name for instance when opening a file `a` and then doing `:w b` where file.name will be the former and path the latter. --- vis.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 341e6ed..dcd7457 100644 --- a/vis.c +++ b/vis.c @@ -64,12 +64,14 @@ bool vis_event_emit(Vis *vis, enum VisEvents id, ...) { File *file = va_arg(ap, File*); if (file->internal) break; - if (id == VIS_EVENT_FILE_OPEN && vis->event->file_open) + if (id == VIS_EVENT_FILE_OPEN && vis->event->file_open) { vis->event->file_open(vis, file); - else if (id == VIS_EVENT_FILE_SAVE_POST && vis->event->file_save_post) - vis->event->file_save_post(vis, file); - else if (id == VIS_EVENT_FILE_CLOSE && vis->event->file_close) + } else if (id == VIS_EVENT_FILE_SAVE_POST && vis->event->file_save_post) { + const char *path = va_arg(ap, const char*); + vis->event->file_save_post(vis, file, path); + } else if (id == VIS_EVENT_FILE_CLOSE && vis->event->file_close) { vis->event->file_close(vis, file); + } break; } case VIS_EVENT_WIN_OPEN: -- cgit v1.2.3