Added the undofile() function. Updated runtime files.
diff --git a/src/eval.c b/src/eval.c
index 06615ae..865dc3a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -731,6 +731,7 @@
static void f_trunc __ARGS((typval_T *argvars, typval_T *rettv));
#endif
static void f_type __ARGS((typval_T *argvars, typval_T *rettv));
+static void f_undofile __ARGS((typval_T *argvars, typval_T *rettv));
static void f_values __ARGS((typval_T *argvars, typval_T *rettv));
static void f_virtcol __ARGS((typval_T *argvars, typval_T *rettv));
static void f_visualmode __ARGS((typval_T *argvars, typval_T *rettv));
@@ -7825,6 +7826,7 @@
{"trunc", 1, 1, f_trunc},
#endif
{"type", 1, 1, f_type},
+ {"undofile", 1, 1, f_undofile},
{"values", 1, 1, f_values},
{"virtcol", 1, 1, f_virtcol},
{"visualmode", 0, 1, f_visualmode},
@@ -17584,6 +17586,23 @@
}
/*
+ * "undofile(name)" function
+ */
+ static void
+f_undofile(argvars, rettv)
+ typval_T *argvars;
+ typval_T *rettv;
+{
+ rettv->v_type = VAR_STRING;
+#ifdef FEAT_PERSISTENT_UNDO
+ rettv->vval.v_string = u_get_undo_file_name(get_tv_string(&argvars[0]),
+ FALSE);
+#else
+ rettv->vval.v_string = NULL;
+#endif
+}
+
+/*
* "values(dict)" function
*/
static void
diff --git a/src/proto/undo.pro b/src/proto/undo.pro
index 90e11d2..cea7d49 100644
--- a/src/proto/undo.pro
+++ b/src/proto/undo.pro
@@ -7,8 +7,9 @@
int u_savedel __ARGS((linenr_T lnum, long nlines));
int undo_allowed __ARGS((void));
void u_compute_hash __ARGS((char_u *hash));
-void u_read_undo __ARGS((char_u *name, char_u *hash));
+char_u *u_get_undo_file_name __ARGS((char_u *buf_ffname, int reading));
void u_write_undo __ARGS((char_u *name, int forceit, buf_T *buf, char_u *hash));
+void u_read_undo __ARGS((char_u *name, char_u *hash));
void u_undo __ARGS((int count));
void u_redo __ARGS((int count));
void undo_time __ARGS((long step, int sec, int absolute));
diff --git a/src/undo.c b/src/undo.c
index 88c0305..34140f2 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -100,7 +100,6 @@
static void u_freeentries __ARGS((buf_T *buf, u_header_T *uhp, u_header_T **uhpp));
static void u_freeentry __ARGS((u_entry_T *, long));
#ifdef FEAT_PERSISTENT_UNDO
-static char_u *u_get_undo_file_name __ARGS((char_u *, int reading));
static void corruption_error __ARGS((char *msg, char_u *file_name));
static void u_free_uhp __ARGS((u_header_T *uhp));
static int serialize_uep __ARGS((u_entry_T *uep, FILE *fp));
@@ -698,7 +697,7 @@
* When "reading" is FALSE use the first name where the directory exists.
* Returns NULL when there is no place to write or no file to read.
*/
- static char_u *
+ char_u *
u_get_undo_file_name(buf_ffname, reading)
char_u *buf_ffname;
int reading;