help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Minor improvements for mod_ksh93
Date: Sat, 11 Mar 2023 13:07:24 -0800	[thread overview]
Message-ID: <CAH+w=7YPpvqYOy2ZZQDcF-Edz+ZYNC29u_E5mzwVjAc+YxRrKQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 72 bytes --]

Clarify availability of ksh-mode parameters, improve vi-mode detection.

[-- Attachment #2: zsh_2023-03-11_p1.txt --]
[-- Type: text/plain, Size: 1840 bytes --]

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.
@@ -45,7 +47,7 @@ A named reference to the ZLE special parameter `tt(CURSOR)'.
 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");
 	    strcpy(sh_edmode, "");

                 reply	other threads:[~2023-03-11 21:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7YPpvqYOy2ZZQDcF-Edz+ZYNC29u_E5mzwVjAc+YxRrKQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).