From xemacs-m  Sat Jun  7 00:12:27 1997
Received: from jagor.srce.hr (hniksic@jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id AAA21697
	for <xemacs-beta@xemacs.org>; Sat, 7 Jun 1997 00:12:25 -0500 (CDT)
Received: (from hniksic@localhost)
          by jagor.srce.hr (8.8.5/8.8.4)
	  id HAA23267; Sat, 7 Jun 1997 07:12:24 +0200 (MET DST)
To: XEmacs Developers <xemacs-beta@xemacs.org>
Subject: [patch] Keymaps at extent endpoints
X-Attribution: Hrv
X-Face: Mie8:rOV<\c/~z{s.X4A{!?vY7{drJ([U]0O=W/<W*SMo/Mv:58:*_y~ki>xDi&N7XG
        KV^$k0m3Oe/)'e%3=$PCR&3ITUXH,cK>]bci&<qQ>Ff%x_>1`T(+M2Gg/fgndU%k*ft
        [(7._6e0n-V%|%'[c|q:;}td$#INd+;?!-V=c8Pqf}3J
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 07 Jun 1997 07:12:24 +0200
Message-ID: <kigwwo7q9mv.fsf@jagor.srce.hr>
Lines: 58
X-Mailer: Gnus v5.4.52/XEmacs 20.3(beta4)

The latest widget has a workaround for extent keymaps not being heeded
at the end of extents (even when they are end-closed).  This patch
fixes that.

Per, can you confirm that this patch fixes widget?  Everyone, can you
confirm that this patch didn't break everything horribly? :-)

The idea was to use `at' flag to `extent-at' to catch all the extents
nearby.  Then I use `extent-in-region-p' to catch the naughty ones.
After this patch, the relevant keymap of the extent is looked up
similar to the way extents are adjusted for insertion.

123x
   ^  cursor here

Now, if we have a [1, 4) extent e, its keymap will be ignored -- as
before.  BUT, if the extent is [1, 4], its keymap will be valid at the 
cursor.  The same goes for extent beginning.  IMHO this is highly
logical, and that's the way it was supposed to be implemented from the 
beginning.

I read Kyle's post, and I don't understand exactly why this behaviour
would ever be a bad thing.  As far as I can see, the only bad thing
was the behaviour as it was before.


--- src/keymap.c.orig	Sat Jun  7 06:06:55 1997
+++ src/keymap.c	Sat Jun  7 07:00:51 1997
@@ -2436,14 +2436,17 @@
   if (!NILP (pos))
     {
       Lisp_Object extent;
-      for (extent = Fextent_at (pos, buffer_or_string, Qkeymap, Qnil, Qnil);
+      for (extent = Fextent_at (pos, buffer_or_string, Qkeymap, Qnil, Qat);
 	   !NILP (extent);
-	   extent = Fextent_at (pos, buffer_or_string, Qkeymap, extent, Qnil))
+	   extent = Fextent_at (pos, buffer_or_string, Qkeymap, extent, Qat))
 	{
-	  Lisp_Object keymap = Fextent_property (extent, Qkeymap, Qnil);
-	  if (!NILP (keymap))
-	    relevant_map_push (get_keymap (keymap, 1, 1), closure);
-	  QUIT;
+	  if (!NILP (Fextent_in_region_p (extent, pos, pos, Qnil)))
+	    {
+	      Lisp_Object keymap = Fextent_property (extent, Qkeymap, Qnil);
+	      if (!NILP (keymap))
+		relevant_map_push (get_keymap (keymap, 1, 1), closure);
+	      QUIT;
+	    }
 	}
     }
 }


-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
I'm sure they'll listen to reason! -- Neal Stevenson, _Snow Crash_

