emacs-devel
[Top][All Lists]
Advanced

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

local keymap patch for key-binding


From: Chong Yidong
Subject: local keymap patch for key-binding
Date: Sat, 09 Sep 2006 11:08:46 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

I have written a patch to address the following item in FOR-RELEASE:

    ** Make key-binding use the maps specified by positions given in
       the events.

If a vector is passed to key-binding, and the first element of the
vector looks like a valid click event, and the position specified by
that click event contains a `keymap' property, then we look in that
keymap first.

Any objections to checking this in?

*** emacs/src/keymap.c.~1.330.~ 2006-07-24 11:48:55.000000000 -0400
--- emacs/src/keymap.c  2006-09-09 11:06:23.000000000 -0400
***************
*** 1576,1581 ****
--- 1576,1606 ----
  
    GCPRO1 (key);
  
+ #ifdef HAVE_MOUSE
+   if (VECTORP (key)
+       && ASIZE (key) > 0
+       && CONSP (AREF (key, 0))
+       && SYMBOLP (XCAR (AREF (key, 0)))
+       && CONSP (XCDR (AREF (key, 0))))
+     {
+       Lisp_Object map, obj, pos = XCAR (XCDR (AREF (key, 0)));
+ 
+       if (XINT (Flength (pos)) == 10 && INTEGERP (XCAR (XCDR (pos))))
+       {
+         obj = Fnth (make_number(4), pos);
+         map = Fget_char_property (XCAR (XCDR (pos)),
+                                   Qkeymap,
+                                   NILP (obj) ? Fwindow_buffer (XCAR (pos)) : 
obj);
+         if (!NILP (Fkeymapp (map)))
+           {
+             value = Flookup_key (map, key, accept_default);
+             if (! NILP (value) && !INTEGERP (value))
+               goto done;
+           }
+       }
+     }
+ #endif /* HAVE_MOUSE  */
+ 
    if (!NILP (current_kboard->Voverriding_terminal_local_map))
      {
        value = Flookup_key (current_kboard->Voverriding_terminal_local_map,




reply via email to

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