From 74d3a1e7d6450f226d2f942d0c0e3410eea87dfc Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 11 Oct 2021 13:15:41 +0200 Subject: Allow :keys in menus to be computed dynamically * doc/lispref/keymaps.texi (Extended Menu Items): Document it (bug#28930). * src/keyboard.c (parse_menu_item): Allow :keys to be a function. --- src/keyboard.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/keyboard.c') diff --git a/src/keyboard.c b/src/keyboard.c index 9a50a5e5eb7..7184b1509b1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -7841,7 +7841,9 @@ parse_menu_item (Lisp_Object item, int inmenubar) else if (EQ (tem, QCkeys)) { tem = XCAR (item); - if (CONSP (tem) || STRINGP (tem)) + if (FUNCTIONP (tem)) + ASET (item_properties, ITEM_PROPERTY_KEYEQ, call0 (tem)); + else if (CONSP (tem) || STRINGP (tem)) ASET (item_properties, ITEM_PROPERTY_KEYEQ, tem); } else if (EQ (tem, QCbutton) && CONSP (XCAR (item))) -- cgit v1.2.3