]> git.eshelyaron.com Git - emacs.git/commitdiff
Make function-key-map apply when key is bound to `undefined'.
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 25 Oct 2011 12:54:04 +0000 (08:54 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 25 Oct 2011 12:54:04 +0000 (08:54 -0400)
* src/keyboard.c (test_undefined): New function.
(read_key_sequence): Use it to detect when a key is bound to `undefined'.

Fixes: debbugs:9751
src/ChangeLog
src/keyboard.c

index cee48bd1731a1cb63050c2082c37ea5a09cb42e9..52581be2863972d55bbc7047064ab752999b15a5 100644 (file)
@@ -1,3 +1,8 @@
+2011-10-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * keyboard.c (test_undefined): New function (bug#9751).
+       (read_key_sequence): Use it to detect when a key is bound to `undefined'.
+
 2011-10-25  Enami Tsugutomo  <tsugutomo.enami@jp.sony.com>
 
        * sysdep.c (init_sys_modes): Fix the check for the controlling
index 6f3bfd8c1e72dc139e0a660ba7774abf22d7943c..eb316947dcbc3be1ac781d5be3cb83fd73b7717e 100644 (file)
@@ -8902,6 +8902,14 @@ keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey,
   return 0;
 }
 
+static int
+test_undefined (Lisp_Object binding)
+{
+  return (EQ (binding, Qundefined)
+         || (!NILP (binding) && SYMBOLP (binding)
+             && EQ (Fcommand_remapping (binding, Qnil, Qnil), Qundefined)));
+}
+
 /* Read a sequence of keys that ends with a non prefix character,
    storing it in KEYBUF, a buffer of size BUFSIZE.
    Prompt with PROMPT.
@@ -9852,7 +9860,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
            }
        }
 
-      if (first_binding < nmaps && NILP (submaps[first_binding])
+      if (first_binding < nmaps
+         && NILP (submaps[first_binding])
+         && !test_undefined (defs[first_binding])
          && indec.start >= t)
        /* There is a binding and it's not a prefix.
           (and it doesn't have any input-decode-map translation pending).
@@ -9879,7 +9889,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
                                  /* If there's a binding (i.e.
                                     first_binding >= nmaps) we don't want
                                     to apply this function-key-mapping.  */
-                                 fkey.end + 1 == t && first_binding >= nmaps,
+                                 fkey.end + 1 == t
+                                 && (first_binding >= nmaps
+                                     || test_undefined (defs[first_binding])),
                                  &diff, prompt);
            UNGCPRO;
            if (done)