From xemacs-m  Fri Mar 21 22:01:07 1997
Received: from crystal.WonderWorks.COM (crystal.WonderWorks.com [192.203.206.1])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id WAA26606
	for <xemacs-beta@xemacs.org>; Fri, 21 Mar 1997 22:01:06 -0600 (CST)
Received: by crystal.WonderWorks.COM 
	id QQchxo06180; Fri, 21 Mar 1997 23:01:05 -0500 (EST)
Date: Fri, 21 Mar 1997 23:01:05 -0500 (EST)
Message-Id: <QQchxo06180.199703220401@crystal.WonderWorks.COM>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Kyle Jones <kyle_jones@wonderworks.com>
To: xemacs-beta@xemacs.org
Subject: [PATCH] 19.15-b102 for treedir keyboard version and BIG BUG.
In-Reply-To: <m3u3m5i417.fsf@jens.metrix.de>
References: <m3u3m5i417.fsf@jens.metrix.de>
X-Mailer: VM 6.21 under 19.15 XEmacs Lucid (beta102)
X-Face: /cA45WHG7jWq>(O3&Z57Y<"WsX5ddc,4c#w0F*zrV#=M
        0@~@,s;b,aMtR5Sqs"+nU.z^CSFQ9t`z2>W,S,]:[+2^
        Nbf6v4g>!&,7R4Ot4Wg{&tm=WX7P["9%a)_da48-^tGy
        ,qz]Z,Zz\{E.,]'EO+F)@$KtF&V

Jens Lautenbacher writes:
 > [...]
 > Signaling: (wrong-type-argument keymapp #<EMACS BUG: ILLEGAL DATATYPE 
 > (#o37777777773) Save your buffers immediately and please report this bug>)

Two problems.  The problem above is that XEmacs is reading off
the end of an array.  I have a patch for that.

The other problem is with your code, Jens.  The treedir buffer
piles up a large number of overlapping extents with local keymaps.
The keymap lookup code limits the number of keymaps that it will
search to 100 and when you hit that limit you lose the buffer
local keymap.  The places where you see the current local keymap
disappearing is where 99 or more extents overlap.  You should
take care that this kind of pileup doesn't happen.

I think the keymap code could handle this better, but I want to
patch things minimally for 19.15.  Here's the patch, which also
contains a missing NILP check that I noticed was missing in one
of the `if' branches.

*** 1.1	1997/03/22 02:52:44
--- src/keymap.c	1997/03/22 03:46:38
***************
*** 2381,2388 ****
  
  	      if (!EQ (buffer, Vmouse_grabbed_buffer)) /* already pushed */
  		{
  		  get_relevant_minor_maps (buffer, &closure);
! 		  relevant_map_push (XBUFFER (buffer)->keymap, &closure);
  		}
  	    }
  	}
--- 2381,2391 ----
  
  	      if (!EQ (buffer, Vmouse_grabbed_buffer)) /* already pushed */
  		{
+ 		  Lisp_Object map = XBUFFER (buffer)->keymap;
+ 
  		  get_relevant_minor_maps (buffer, &closure);
! 		  if (!NILP(map))
! 		    relevant_map_push (map, &closure);
  		}
  	    }
  	}
***************
*** 2621,2626 ****
--- 2624,2631 ----
    assert (EVENTP (event0));
  
    nmaps = get_relevant_keymaps (event0, countof (maps), maps);
+   if (nmaps > countof (maps))
+     nmaps = countof (maps);
    return (process_event_binding_result
  	  (lookup_events (event0, nmaps, maps, accept_default)));
  }

