help / color / mirror / code / Atom feed
* setopt emacs / vi again
@ 2023-03-06 22:44 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2023-03-06 22:44 UTC (permalink / raw)
  To: Zsh hackers list

Back in workers/50729, Jun T wrote:
> Use of EMACS/VI should be highly discouraged, since turning them off
> has no effect, and they are meaningless if a user-defined keymap
> is in use.

There was a subsequent patch in workers/50851 that includes some doc updates:

> item(tt(EMACS))(
>  If ZLE is loaded, turning on this option has the equivalent effect
> +of `tt(bindkey -e)'.  In addition, the tt(VI) option is unset.
>  Turning it off has no effect.  The option setting is
> +not guaranteed to reflect the current keymap, and the tt(LOCALOPTIONS)
> +option does not work correctly. This option is provided only for
> +compatibility, and its use is highly discouraged.  tt(bindkey) is the
> +recommended interface.
> )

and similar wording for setopt vi, along with some code changes so
that bindkey commands force the option settings to match the selected
main keymap.  (It's still a bit of a shortcoming that there is no way
to query which keymap is currently linked.)

> In doshfunc() we can't tell to which keymap we should link the 'main'
> keymap because both EMACS and VI may be off in the saved opts[].

As is probably obvious from recent patches, I've been noodling around
with ksh93, and consequently I re-discovered the origin of the emacs
and vi setopts:  ksh has

set -o vi
set -o emacs
set -o gmacs

(the latter probably more recent than the zsh attempt to copy them).
The key point in relation to the zsh options is that, in ksh93, if
none of these options is set, then line editing is completely disabled
-- the zsh equivalent of "unsetopt zle".  There's no question of which
keymap to link, because there isn't any keymap at all.

I'm not suggesting that we actually do this in zsh -- I think the
current state is likely the best we can do.  However, if we again
discuss deprecating these setopts, it may be useful to know where they
came from and how they affect ksh emulation.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-06 22:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-06 22:44 setopt emacs / vi again Bart Schaefer

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).