tex: write before ! or make if autowrite is set - neatvi - [fork] simple vi-typ… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit ebe8300559aa61f5a7c2f8933f96e04cb13eace1 | |
parent 7c82b9f9d2c4c6196b90f7679d255d903e639ccc | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Fri, 5 Jun 2015 20:40:40 +0430 | |
ex: write before ! or make if autowrite is set | |
Diffstat: | |
M ex.c | 11 +++++++---- | |
1 file changed, 7 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/ex.c b/ex.c | |
t@@ -166,13 +166,14 @@ static int ex_region(char *loc, int *beg, int *end) | |
static int ec_write(char *ec); | |
-static int ex_modifiedbuffer(void) | |
+static int ex_modifiedbuffer(char *msg) | |
{ | |
if (!lbuf_modified(xb)) | |
return 0; | |
if (xaw && xpath[0]) | |
return ec_write("w"); | |
- ex_show("buffer modified\n"); | |
+ if (msg) | |
+ ex_show(msg); | |
return 1; | |
} | |
t@@ -181,7 +182,7 @@ static int ec_quit(char *ec) | |
char cmd[EXLEN]; | |
ex_cmd(ec, cmd); | |
if (!strchr(cmd, '!')) | |
- if (ex_modifiedbuffer()) | |
+ if (ex_modifiedbuffer("buffer modified\n")) | |
return 1; | |
xquit = 1; | |
return 0; | |
t@@ -195,7 +196,7 @@ static int ec_edit(char *ec) | |
ex_cmd(ec, cmd); | |
ex_arg(ec, arg); | |
if (!strchr(cmd, '!')) | |
- if (ex_modifiedbuffer()) | |
+ if (ex_modifiedbuffer("buffer modified\n")) | |
return 1; | |
if (!arg[0] || !strcmp(arg, "%") || !strcmp(xpath, arg)) { | |
strcpy(arg, xpath); | |
t@@ -499,6 +500,7 @@ static int ec_substitute(char *ec) | |
static int ec_exec(char *ec) | |
{ | |
char cmd[EXLEN]; | |
+ ex_modifiedbuffer(NULL); | |
return cmd_exec(ex_cmd(ec, cmd)); | |
} | |
t@@ -506,6 +508,7 @@ static int ec_make(char *ec) | |
{ | |
char cmd[EXLEN]; | |
char make[EXLEN]; | |
+ ex_modifiedbuffer(NULL); | |
sprintf(make, "make %s", ex_cmd(ec, cmd)); | |
return cmd_exec(make); | |
} |