about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Doc/Zsh/grammar.yo3
-rw-r--r--Doc/Zsh/mod_ksh93.yo8
-rw-r--r--Src/Modules/ksh93.c5
4 files changed, 18 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index c32e38e7b..b4952c8d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-03-11  Bart Schaefer  <schaefer@zsh.org>
+
+	* 51558: Doc/Zsh/grammar.yo: Clarify "for" loops + named refs.
+
+	* 51557: Doc/Zsh/mod_ksh93.yo, Src/Modules/ksh93.c: Clarify
+	availability of ksh-mode parameters, improve vi-mode detection.
+
 2023-03-11  Oliver Kiddle  <opk@zsh.org>
 
 	* 51539: Completion/Unix/Command/_git: don't complete diff
diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index 1b834f41a..915b93bc0 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -190,6 +190,9 @@ use the positional parameters instead of the var(word)s.
 If any var(name) has been declared as a named reference,
 the corresponding var(word) is treated as the name of a
 parameter and var(name) is made a reference to that.
+Note that for the positional parameters, this treats the
+value of each positional as parameter name rather than
+creating a reference to the position.
 
 The var(term) consists of one or more newline or tt(;)
 which terminate the var(word)s, and are optional when the
diff --git a/Doc/Zsh/mod_ksh93.yo b/Doc/Zsh/mod_ksh93.yo
index d58b979b9..99dab385f 100644
--- a/Doc/Zsh/mod_ksh93.yo
+++ b/Doc/Zsh/mod_ksh93.yo
@@ -24,8 +24,10 @@ enditem()
 
 subsect(Ksh Parameters)
 cindex(parameters, ksh)
-Parameters supplied by this module that are marked with `<K>' below are
-available only in ksh emulation.
+Parameters supplied by this module that are marked with `<K>' below
+are available only when ksh emulation is active before entry to the
+shell function, that is, `tt(emulate ksh)' locally to a function does
+not populate these parameters for that function.
 
 startitem()
 vindex(.sh.command)
@@ -45,7 +47,7 @@ A named reference to the ZLE special parameter `tt(CURSOR)'.
 vindex(.sh.edmode)
 item(tt(.sh.edmode) <K>)(
 In a ZLE widget, this parameter has the value tt(ESC) (tt($'\e')) if the
-`tt(main)' keymap is selected, and the empty string otherwise.  This is
+tt(VI) option is set and the `tt(main)' keymap is selected.  This is
 intended for use with vi-mode key bindings (`tt(bindkey -v)').  In a
 future revision, assigning `tt(.sh.edchar=${.sh.edmode})' is expected
 to initiate `tt(vicmd)' mode when `tt(viins)' is active, and do
diff --git a/Src/Modules/ksh93.c b/Src/Modules/ksh93.c
index 9dc75c93c..51999dd71 100644
--- a/Src/Modules/ksh93.c
+++ b/Src/Modules/ksh93.c
@@ -168,8 +168,9 @@ ksh93_wrapper(Eprog prog, FuncWrap w, char *name)
     if (zleactive) {
 	extern mod_import_variable char *curkeymapname;	/* XXX */
 	extern mod_import_variable char *varedarg;	/* XXX */
-	/* How to distinguish emacs bindings? */
-	if (curkeymapname && strcmp(curkeymapname, "main") == 0)
+	/* bindkey -v forces VIMODE so this test is as good as any */
+	if (curkeymapname && isset(VIMODE) &&
+	    strcmp(curkeymapname, "main") == 0)
 	    strcpy(sh_edmode, "\e");
 	else
 	    strcpy(sh_edmode, "");