From 9d56e0da1fe2128b9c7ffdf05f5f7b9ad2ece9fc Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 11 Feb 2006 13:50:29 +0000 Subject: [PATCH] (Venable_disabled_menus_and_buttons): New variable. (syms_of_keyboard): DEVFAR_LISP and initialize it. (parse_tool_bar_item, parse_menu_item): If that variable is non-nil, don't disable menu items and tool-bar buttons. --- src/keyboard.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index d5c5f184cfa..a1b8ad34b07 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -649,6 +649,11 @@ static EMACS_TIME timer_idleness_start_time; static EMACS_TIME timer_last_idleness_start_time; +/* If non-nil, events produced by disabled menu items and tool-bar + buttons are not ignored. Help functions bind this to allow help on + those items and buttons. */ +Lisp_Object Venable_disabled_menus_and_buttons; + /* Global variable declarations. */ @@ -7271,7 +7276,9 @@ parse_menu_item (item, notreal, inmenubar) if (SYMBOLP (item)) { tem = Fget (item, Qmenu_enable); - if (!NILP (tem)) + if (!NILP (Venable_disabled_menus_and_buttons)) + AREF (item_properties, ITEM_PROPERTY_ENABLE) = Qt; + else if (!NILP (tem)) AREF (item_properties, ITEM_PROPERTY_ENABLE) = tem; } } @@ -7300,7 +7307,12 @@ parse_menu_item (item, notreal, inmenubar) item = XCDR (item); if (EQ (tem, QCenable)) - AREF (item_properties, ITEM_PROPERTY_ENABLE) = XCAR (item); + { + if (!NILP (Venable_disabled_menus_and_buttons)) + AREF (item_properties, ITEM_PROPERTY_ENABLE) = Qt; + else + AREF (item_properties, ITEM_PROPERTY_ENABLE) = XCAR (item); + } else if (EQ (tem, QCvisible) && !notreal) { /* If got a visible property and that evaluates to nil @@ -7820,8 +7832,13 @@ parse_tool_bar_item (key, item) value = XCAR (XCDR (item)); if (EQ (key, QCenable)) - /* `:enable FORM'. */ - PROP (TOOL_BAR_ITEM_ENABLED_P) = value; + { + /* `:enable FORM'. */ + if (!NILP (Venable_disabled_menus_and_buttons)) + PROP (TOOL_BAR_ITEM_ENABLED_P) = Qt; + else + PROP (TOOL_BAR_ITEM_ENABLED_P) = value; + } else if (EQ (key, QCvisible)) { /* `:visible FORM'. If got a visible property and that @@ -11471,6 +11488,14 @@ If the value is not a number, such messages don't time out. */); The value of that variable is passed to `quit-flag' and later causes a peculiar kind of quitting. */); Vthrow_on_input = Qnil; + + DEFVAR_LISP ("enable-disabled-menus-and-buttons", + &Venable_disabled_menus_and_buttons, + doc: /* If non-nil, don't ignore events produced by disabled menu items and tool-bar. + +Help functions bind this to allow help on disabled menu items +and tool-bar buttons. */); + Venable_disabled_menus_and_buttons = Qnil; } void -- 2.39.2