<<< Date Index >>>     <<< Thread Index >>>

Re: Question about key bindings



On Fri, Dec 12, 2003 at 01:54:41AM -0500, David Yitzchak Cohen wrote:
> Disclaimer: I haven't even looked at the involved code here, so everything
> below is purely conjecture.  Can somebody familiar with the keybinding
> code comment, please?
> On Thu, Dec 11, 2003 at 05:05:09PM +0100, Jens Paulus wrote:
> > here is a question about key bindings.
> ...and here is an answer about said subject :-)
> > The L key is by default index
> > bound with list-reply and at the same time generic bound with
> > bottom-page which you can see when you open the help screen. This
> > collision makes pressing the L key only execute list-reply and not
> > bottom-page which I would like to have.
> Right - an index bind takes precedence over a generic bind within the
> index menu.  In other words, if a "bind index l blahblahblah" exists, it
> doesn't matter whether or not there is a "bind generic l somethingorother"
> anywhere.

A brief glance at the code (keymap.c, function km_dokey()) says you're
right on the money here, Dave.  First it checks the current menu
(i.e. index, browser, pager, etc.), then it checks the editor map if
in the editor menu (why this is different from other menus I don't
know), then it checks the generic map.

> > Now if I do
> > :bind index L noop
> > I would expect that now that the index binding is gone the generic
> > binding is automatically active but it is not. Why?
> Binding something to noop doesn't remove the keybinding, obviously :-)
> In other words, "noop"ing a key doesn't remove it from the keybinding
> table ... net result, the noop keybinding takes precedence over the
> real keybinding.  Bug? kinda.  Wishlist? definitely.

Bug?  Resounding "Yes!"
>From the 1.5 manual, section 3.3 "Changing the default key bindings":
  function specifies which action to take when key is pressed.  For a
  complete list of functions, see the ``reference''.  The special
  function noop unbinds the specified key sequence.

Either the manual is incorrect, or the code is.  While Lessig's law
indicates that ipso facto, the former is true, it is probable that the
latter is actually of more concern.  That is, the manual describes
desirable behavior, and therefore _should_ be correct.  If the code
says otherwise, it ought to be fixed.

Actually, in my opinion, binding a key to noop should have the
behavior as coded, but there should be added an "unbind" command which
deletes a binding from the table.

Expect a posting from me to mutt-dev in a little while either
containing a patch or saying "gosh this was harder than I thought."
:-)

Shalom,
 Allister

-- 
Allister MacLeod <amacleod@xxxxxxxx> | http://amacleod.is-a-geek.org/
 Elen síla lúmenn'omentielvo.