[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What happened to the key-menu patch?

From: Stefan Monnier
Subject: Re: What happened to the key-menu patch?
Date: Thu, 11 Jul 2002 13:13:10 -0400

>       Also there
>     is the issue of eliminating/merging duplicate bindings, which I think
>     XEmacs' code punts on by declaring that `map-keymap' does not look at
>     the keymap's parent(s).
> By duplicate bindings do you mean shadowed bindings?

Both shadowed bindings and bindings which are both prefixes (such
that the first doesn't completely shadow the second).

> I think that if you ask for "scan the parents", by default you should
> get all the bindings, including shadowed bindings.  However, there
> could be an optional feature to ignore shadowed bindings.

What do you mean by "ignore" ?
Does that mean that if I do

        (let ((map (make-spase-keymap)))
          (set-keymap-marent map global-map)
          (define-key map "\C-x" (make-sparse-keymap)))

I'might never see any of the C-x bindings in `global-map' ?

> That is not
> terribly hard to do.  Just do a lookup for that event type, and see if
> the binding that it reports is the one you have in hand.  I think that
> there is already code to do this, probably in where-is-internal.

Lookup is O(N) and it would be done for every binding in the keymap,
so it might be easy but algorithmically expensive.
In the case of where-is-internal it's OK because it's done once after
scanning the whole keymap anyway.

> As for merging of subkeymaps, you don't have to worry about that.
> read-key-sequence implicitly merges the keymaps that it gets for a
> prefix key, when it gets them from different maps.  But it does not
> merge the prefix definition from one map A with prefix definitions
> from its parent B.  That is handled by making the prefix binding found
> in map A have as its parent the prefix binding found in map B.
> In other words, for scanning parents, you don't have to do anything
> special when the binding is a keymap.

Of course, I know about the fix_submap_inheritance kludge.
But the problem is that it might not have been executed yet,
so maybe map_keymap would need to do it.  Also what about merging
`menu-item's ?  Should they be merged ?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]