zsh-workers
 help / color / mirror / code / Atom feed
* A couple of questions on 'bindkey'
@ 1999-03-22 20:05 Anthony Heading
  1999-03-23  9:00 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Anthony Heading @ 1999-03-22 20:05 UTC (permalink / raw)
  To: zsh-workers

Hi,
	I'm hacking the keymap code a bit at the moment.  Am now looking for a
way to switch between multiple keymaps which is more general than
bindkey -e/-v, and which also allows one to switch keymaps temporarily. 
Two possibilities come to mind:

	o    Switching via invocation of some new 'keymap' builtin
	o    setting a magical shell parameter: e.g. KEYMAP=myemacs

	Is either of these a generally preferred mechanism?

	Also, having now ripped 'bindkey' to bits, I have the dull task of
putting it back together. And therein I was somewhat struck by the
heavyweight nature of the code which binds keys to 'ranges'.  When this
is really ever needed?  Why wouldn't a simple shell loop be a better
solution?    Clearly it's needed to support reading back keymaps which
were dumped in this format, but that seems to me somewhat redundant too.

	Would it be a good/bad/utterly unacceptable thing to remove this
functionality?  (I have to concede a hidden agenda - under my brave new
world the housekeeping to keep track of whether we're in such a range is
even more cumbersome...)

Regards

Anthony


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: A couple of questions on 'bindkey'
@ 1999-03-23 17:39 Anthony Heading
  0 siblings, 0 replies; 5+ messages in thread
From: Anthony Heading @ 1999-03-23 17:39 UTC (permalink / raw)
  To: zsh-workers

Peter wrote:
> It's quite possible Zefram intended to add some way of doing this, given
> the existence of arbitrary keymaps.  Probably the most natural way is a new
> option to bindkey, e.g. `bindkey -S keymap' to select a keymap:  select is
> the word current used in the bindkey entry in the zshmodules manual page,
> and bindkey already takes a `-M keymap' option to choose which keymap to
> operate on, so this would fit.

Mmm hmm. There's sort-of the capacity to do that now by linking to
'main' with the bindkey -A option, but it's somewhat half-arsed. 
Ignoring for a moment if I may what's in place already, I imagined one
putative advantage of a KEYMAP variable is conceptually that it could be
local to a function, and restored implictly on exit using the normal
typeset mechanism.  (Not sure that this works for special variables, but
it might do).  However I'm sure that given the frequent resets to 'main'
of the current keymap that crashing out of a function in a different
keymap might not necessarily be a problem even without 'trap'
shenanigans.

But that's a very helpful answer.  If a shell param doesn't seem
obviously the appropriate way to handle setting such things as keymaps
then it's probably not worthwhile adding the complexity.

> Or do you mean the listing code for output, bs->firstseq etc.?  That's
> just a convenience to make the output neater.  Even there it doesn't need
> to know how the keys were originally *bound*, just how they happen to be in
> the current keymap. That's quite useful, since having the output
> " "-"~" self-insert
> is a big win compared with the other possibility of showing all 95
> characters.

Well, I meant the whole shebang really.  Case in point - I don't really
understand why you say the output " "-"~" is a big win.  Who wants this
in the first place?  And why are they grateful that it's 94 lines
shorter than it otherwise would be?  For me, it just breaks the ability
to do a simple regexp grep for no real benefit.

Anyhow, I conclude that the existing behaviour is not regarded as
especially egregious.  And as you say, it not exactly rocket science to
maintain.  So I'll try to preserve it.

Thanks

A


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-03-24  4:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-22 20:05 A couple of questions on 'bindkey' Anthony Heading
1999-03-23  9:00 ` Peter Stephenson
1999-03-23 12:41   ` bindkey -A evil ... (was: RE: A couple of questions on 'bindkey' ) Andrej Borsenkow
1999-03-24  4:07     ` Anthony Heading
1999-03-23 17:39 A couple of questions on 'bindkey' Anthony Heading

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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