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

Re: [broken-patch] unbind command



On Mon, Dec 15, 2003 at 11:24:02AM -0500, Allister MacLeod wrote:
> On Mon, Dec 15, 2003 at 12:01:52AM -0500, David Yitzchak Cohen wrote:
> > On Sat, Dec 13, 2003 at 01:06:40AM -0500, Allister MacLeod wrote:
> > > On Fri, Dec 12, 2003 at 09:18:08AM -0800, Michael Elkins wrote:
> > > > On 2003-12-12, Allister MacLeod wrote:

> However, looking at the code and thinking about it, it occurs to me
> that I was perhaps barking up the wrong tree with my attempted
> reimplementation of DGC's patch.  Perhaps a simpler patch would be to
> alter the key-handling code to fall back to the generic map when it
> finds an OP_NULL in the current menu.  That way, you'd only get a "key
> unbound" error if the key was truly never bound, or if it was bound to
> 'noop' in both the current menu and the generic map.

There's only one problem with that: if you have a generic binding and
an index binding, and then you bind the index thingy to noop, you'll
report a bug that binding to noop is a noop, and correctly too, since the
docs would seem to indicate that nooping a key makes it behave unbound,
with no mention of falling back to generic for certain menus.  The net
result is that there's no straightforward answer to the question of
"What the heck should the code do?" given the current docs.  In other
words, the docs need to be fixed no matter what you do to the code itself.

> Still, it rankles with my "ivory tower code-purity nerd" side to have
> the operation to "unbind" a key actually be the addition of a
> null-shaped blob, rather than truly the removal of the binding.  If
> the baseline were a keymap full of OP_NULL's, it would not bother me
> at all.  However, the baseline is a map that is empty save for "real"
> bindings.

Eh, ivory towers are cool to keep in mind in the design of a program,
but once it's gotten as big as Mutt, ivory towers mean lots of work.

> Since the fall-through patch that I described above should be much
> easier to create, I will probably have it to post very soon today.

Hmm ... the doc change necessary for that is rather trivial - just
pointing out that nooping a key won't necessarily noop it if you've
got a generic binding for it ... and that as a consequence, any key
that has a generic binding can never be unbound for any particular mode
(except the ones that don't consult generic - pager and editor, IIRC)
without unbinding it from all modes it's in.  (I guess you can macro the
key to some other unbound key to achieve the same result, but then your
RC files can kiss their ivory towers goodbye, too.  The other option is
just to bind keys individually for all their modes, and to avoid generic
like the plague.)

Thanks, either way,
 - Dave

-- 
Uncle Cosmo, why do they call this a word processor?
It's simple, Skyler.  You've seen what food processors do to food, right?

Please visit this link:
http://rotter.net/israel

Attachment: pgp4mSuXCoxiA.pgp
Description: PGP signature