aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-11-21 23:32:28 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-11-22 14:57:26 +0100
commitf555c00e0b0be14cd553c7c803d6136b86f2012b (patch)
tree30cc25c10c18cd70b585ebc2c3b27b1631049ec5 /vis.c
parenta7115b12267f6165426d0540da6ab0ae6f90a191 (diff)
downloadvis-f555c00e0b0be14cd553c7c803d6136b86f2012b.tar.gz
vis-f555c00e0b0be14cd553c7c803d6136b86f2012b.tar.xz
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.
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c10
1 files changed, 6 insertions, 4 deletions
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: