From 2db8f1738723969e558e3e9417ef3dff39ab7bf1 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 22 Jul 2006 21:22:52 +0000 Subject: [PATCH] (Fdefine_key): If the key binding definition looks like an XEmacs-style key sequence, convert it to Emacs's format. --- etc/NEWS | 2 ++ src/ChangeLog | 5 +++++ src/keymap.c | 14 ++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index f06bee9badc..4a2eaf4e225 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -4617,6 +4617,8 @@ Lisp packages using many minor mode keymaps can now maintain their own 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: +++ diff --git a/src/ChangeLog b/src/ChangeLog index 628d5dba0a9..10a525f8a3f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-07-22 Stefan Monnier + + * 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 * w32fns.c (w32_createwindow): If `left' and/or `top' frame diff --git a/src/keymap.c b/src/keymap.c index 71fd5f03390..4871179c420 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1149,6 +1149,20 @@ binding KEY to DEF is added at the front of KEYMAP. */) 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) { -- 2.39.2