summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-08-30 14:11:58 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2014-08-30 14:11:58 -0700
commit5b57f28256d30ebb4a2a13e1128184aec32956de (patch)
treee3ac0ef15c81803abbe62f782e6814ca823f8184
parente01739d2b73153823cb5689ec787202f4d321e2c (diff)
downloadzsh-5b57f28256d30ebb4a2a13e1128184aec32956de.tar.gz
zsh-5b57f28256d30ebb4a2a13e1128184aec32956de.tar.xz
zsh-5b57f28256d30ebb4a2a13e1128184aec32956de.zip
33070: add %(e..) based on %e
-rw-r--r--ChangeLog2
-rw-r--r--Doc/Zsh/prompt.yo1
-rw-r--r--Src/prompt.c11
3 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index cae6399ac..37d111d2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-08-30  Barton E. Schaefer  <schaefer@zsh.org>
 
+	* 33070: Doc/Zsh/prompt.yo, Src/prompt.c: add %(e..) based on %e
+
 	* 33069: Completion/Base/Completer/_expand_alias: remove internal
 	quoting	before looking up aliases when expanding aliases in an
 	unquoted word
diff --git a/Doc/Zsh/prompt.yo b/Doc/Zsh/prompt.yo
index 183a93a3b..17af5b0fb 100644
--- a/Doc/Zsh/prompt.yo
+++ b/Doc/Zsh/prompt.yo
@@ -305,6 +305,7 @@ least var(n) elements relative to the root directory, hence tt(/) is
 counted as 0 elements.)
 sitem(tt(D))(True if the month is equal to var(n) (January = 0).)
 sitem(tt(d))(True if the day of the month is equal to var(n).)
+sitem(tt(e))(True if the evaluation depth is at least var(n).)
 sitem(tt(g))(True if the effective gid of the current process is var(n).)
 sitem(tt(j))(True if the number of jobs is at least var(n).)
 sitem(tt(L))(True if the tt(SHLVL) parameter is at least var(n).)
diff --git a/Src/prompt.c b/Src/prompt.c
index 47625351f..9ed6c54d5 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -372,6 +372,17 @@ putpromptchar(int doprint, int endchar, unsigned int *txtchangep)
 		    if (t0 >= arg)
 			test = 1;
 		    break;
+		case 'e':
+		    {
+			Funcstack fsptr = funcstack;
+			test = arg;
+			while (fsptr && test > 0) {
+			    test--;
+			    fsptr = fsptr->prev;
+			}
+			test = !test;
+		    }
+		    break;
 		case 'L':
 		    if (shlvl >= arg)
 			test = 1;