diff src/ex_docmd.c @ 21493:7449921216bc v8.2.1297

patch 8.2.1297: when a test fails it's often not easy to see where Commit: https://github.com/vim/vim/commit/a5d0423fa16f18b4576a2a07e50034e489587a7d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 26 15:37:02 2020 +0200 patch 8.2.1297: when a test fails it's often not easy to see where Problem: When a test fails it's often not easy to see what the call stack is. Solution: Add more entries from the call stack in the exception message.
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Jul 2020 15:45:04 +0200
parents 5c92877092f9
children c7b2ce90c2de
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -8268,8 +8268,10 @@ find_cmdline_var(char_u *src, int *usedl
 #define SPEC_SFILE  (SPEC_CFILE + 1)
 		    "<slnum>",		// ":so" file line number
 #define SPEC_SLNUM  (SPEC_SFILE + 1)
+		    "<stack>",		// call stack
+#define SPEC_STACK  (SPEC_SLNUM + 1)
 		    "<afile>",		// autocommand file name
-#define SPEC_AFILE  (SPEC_SLNUM + 1)
+#define SPEC_AFILE  (SPEC_STACK + 1)
 		    "<abuf>",		// autocommand buffer number
 #define SPEC_ABUF   (SPEC_AFILE + 1)
 		    "<amatch>",		// autocommand match name
@@ -8520,10 +8522,13 @@ eval_vars(
 		break;
 
 	case SPEC_SFILE:	// file name for ":so" command
-		result = estack_sfile();
+	case SPEC_STACK:	// call stack
+		result = estack_sfile(spec_idx == SPEC_SFILE);
 		if (result == NULL)
 		{
-		    *errormsg = _("E498: no :source file name to substitute for \"<sfile>\"");
+		    *errormsg = spec_idx == SPEC_SFILE
+			? _("E498: no :source file name to substitute for \"<sfile>\"")
+			: _("E489: no call stack to substitute for \"<stack>\"");
 		    return NULL;
 		}
 		resultbuf = result;	    // remember allocated string