changeset 72074:91ea8d22ef60

(Fdefine_key): If the key binding definition looks like an XEmacs-style key sequence, convert it to Emacs's format.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 22 Jul 2006 21:22:52 +0000
parents 88cafd01cf48
children 538434fd1d5d
files etc/NEWS src/ChangeLog src/keymap.c
diffstat 3 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Sat Jul 22 13:56:19 2006 +0000
+++ b/etc/NEWS	Sat Jul 22 21:22:52 2006 +0000
@@ -4617,6 +4617,8 @@
 keymap alist separate from `minor-mode-map-alist' by adding their
 keymap alist to this list.
 
+*** The definition of a key-binding passed to define-key can use XEmacs-style
+key-sequences, such as [(control a)].
 ** Abbrev changes:
 
 +++
--- a/src/ChangeLog	Sat Jul 22 13:56:19 2006 +0000
+++ b/src/ChangeLog	Sat Jul 22 21:22:52 2006 +0000
@@ -1,3 +1,8 @@
+2006-07-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* keymap.c (Fdefine_key): If the key binding definition looks like an
+	XEmacs-style key sequence, convert it to Emacs's format.
+
 2006-07-22  Ralf Angeli  <angeli@caeruleus.net>
 
 	* w32fns.c (w32_createwindow): If `left' and/or `top' frame
--- a/src/keymap.c	Sat Jul 22 13:56:19 2006 +0000
+++ b/src/keymap.c	Sat Jul 22 21:22:52 2006 +0000
@@ -1149,6 +1149,20 @@
 
   meta_bit = VECTORP (key) ? meta_modifier : 0x80;
 
+  if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, make_number (0))))
+    { /* DEF is apparently an XEmacs-style keyboard macro.  */
+      Lisp_Object tmp = Fmake_vector (make_number (ASIZE (def)), Qnil);
+      int i = ASIZE (def);
+      while (--i >= 0)
+	{
+	  Lisp_Object c = AREF (def, i);
+	  if (CONSP (c) && lucid_event_type_list_p (c))
+	    c = Fevent_convert_list (c);
+	  ASET (tmp, i, c);
+	}
+      def = tmp;
+    }
+
   idx = 0;
   while (1)
     {