comparison src/keymap.c @ 5745:f9e4d44504a4

Document #'events-to-keys some more, use it less. lisp/ChangeLog addition: 2013-07-10 Aidan Kehoe <kehoea@parhasard.net> * minibuf.el (get-user-response): * cmdloop.el (y-or-n-p-minibuf): No need to call #'events-to-keys in these two functions, #'lookup-key accepts events directly. * keymap.el: * keymap.el (events-to-keys): Document this function some more. Stop passing strings through unexamined, treat them as vectors of characters. Event keys are never integers, remove some code that only ran if (integerp (event-key ce)). Event keys are never numbers, don't check for that. Don't create (menu-selection call-interactively function-name) keystrokes for menu choices, #'character-to-event doesn't understand that syntax, so nothing uses it. Don't ever accept mouse events, #'character-to-event doesn't accept our synthesising of them. src/ChangeLog addition: 2013-07-10 Aidan Kehoe <kehoea@parhasard.net> * keymap.c: * keymap.c (key_desc_list_to_event): Drop the allow_menu_events argument. Don't accept lists starting with Qmenu_selection as describing keys, nothing generates them in a way this function understands. The intention is reasonable but the implementation was never documented and never finished. * keymap.c (syms_of_keymap): Drop Qmenu_selection. * events.c (Fcharacter_to_event): * keymap.h: Drop the allow_menu_events argument to key_desc_list_to_event.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 10 Jul 2013 14:14:30 +0100
parents 4d15e903800b
children 236e4afc565d
comparison
equal deleted inserted replaced
5738:f6af091ac654 5745:f9e4d44504a4
220 #define INCLUDE_BUTTON_ZERO 220 #define INCLUDE_BUTTON_ZERO
221 #define FROB(num) \ 221 #define FROB(num) \
222 Lisp_Object Qbutton##num; \ 222 Lisp_Object Qbutton##num; \
223 Lisp_Object Qbutton##num##up; 223 Lisp_Object Qbutton##num##up;
224 #include "keymap-buttons.h" 224 #include "keymap-buttons.h"
225
226 Lisp_Object Qmenu_selection;
227 225
228 /* Emacs compatibility */ 226 /* Emacs compatibility */
229 #define FROB(num) \ 227 #define FROB(num) \
230 Lisp_Object Qmouse_##num; \ 228 Lisp_Object Qmouse_##num; \
231 Lisp_Object Qdown_mouse_##num; 229 Lisp_Object Qdown_mouse_##num;
1518 } 1516 }
1519 } 1517 }
1520 1518
1521 /* Used by character-to-event */ 1519 /* Used by character-to-event */
1522 void 1520 void
1523 key_desc_list_to_event (Lisp_Object list, Lisp_Object event, 1521 key_desc_list_to_event (Lisp_Object list, Lisp_Object event)
1524 int allow_menu_events)
1525 { 1522 {
1526 Lisp_Key_Data raw_key; 1523 Lisp_Key_Data raw_key;
1527
1528 if (allow_menu_events &&
1529 CONSP (list) &&
1530 /* #### where the hell does this come from? */
1531 EQ (XCAR (list), Qmenu_selection))
1532 {
1533 Lisp_Object fn, arg;
1534 if (! NILP (Fcdr (Fcdr (list))))
1535 invalid_argument ("Invalid menu event desc", list);
1536 arg = Fcar (Fcdr (list));
1537 if (SYMBOLP (arg))
1538 fn = Qcall_interactively;
1539 else
1540 fn = Qeval;
1541 XSET_EVENT_TYPE (event, misc_user_event);
1542 XSET_EVENT_CHANNEL (event, wrap_frame (selected_frame ()));
1543 XSET_EVENT_MISC_USER_FUNCTION (event, fn);
1544 XSET_EVENT_MISC_USER_OBJECT (event, arg);
1545 return;
1546 }
1547 1524
1548 define_key_parser (list, &raw_key); 1525 define_key_parser (list, &raw_key);
1549 1526
1550 /* The first zero is needed for Apple's i686-apple-darwin8-g++-4.0.1, 1527 /* The first zero is needed for Apple's i686-apple-darwin8-g++-4.0.1,
1551 otherwise the build fails with: 1528 otherwise the build fails with:
4670 #include "keymap-buttons.h" 4647 #include "keymap-buttons.h"
4671 #define FROB(num) \ 4648 #define FROB(num) \
4672 DEFSYMBOL (Qmouse_##num); \ 4649 DEFSYMBOL (Qmouse_##num); \
4673 DEFSYMBOL (Qdown_mouse_##num); 4650 DEFSYMBOL (Qdown_mouse_##num);
4674 #include "keymap-buttons.h" 4651 #include "keymap-buttons.h"
4675 DEFSYMBOL (Qmenu_selection);
4676 DEFSYMBOL (QLFD); 4652 DEFSYMBOL (QLFD);
4677 DEFSYMBOL (QTAB); 4653 DEFSYMBOL (QTAB);
4678 DEFSYMBOL (QRET); 4654 DEFSYMBOL (QRET);
4679 DEFSYMBOL (QESC); 4655 DEFSYMBOL (QESC);
4680 DEFSYMBOL (QDEL); 4656 DEFSYMBOL (QDEL);