Add x-popup-menu-function
* src/menu.c (x_popup_menu_1): If non-nil call x-popup-menu-function. (syms_of_menu): DEFSYM x-popup-menu-function, DEFVAR_LISP it.
This commit is contained in:
parent
a51cfbbd15
commit
17bf6b9efe
1 changed files with 12 additions and 0 deletions
12
src/menu.c
12
src/menu.c
|
@ -1111,6 +1111,12 @@ into menu items. */)
|
|||
Lisp_Object
|
||||
x_popup_menu_1 (Lisp_Object position, Lisp_Object menu)
|
||||
{
|
||||
if (!NILP (Vx_popup_menu_function))
|
||||
return run_hook_with_args (3, ((Lisp_Object[]) {
|
||||
Qx_popup_menu_function, position,
|
||||
menu}),
|
||||
Ffuncall);
|
||||
|
||||
Lisp_Object keymap, tem, tem2 = Qnil;
|
||||
int xpos = 0, ypos = 0;
|
||||
Lisp_Object title;
|
||||
|
@ -1614,6 +1620,7 @@ syms_of_menu (void)
|
|||
|
||||
DEFSYM (Qhide, "hide");
|
||||
DEFSYM (Qx_pre_popup_menu_hook, "x-pre-popup-menu-hook");
|
||||
DEFSYM (Qx_popup_menu_function, "x-popup-menu-function");
|
||||
|
||||
DEFVAR_LISP ("x-pre-popup-menu-hook", Vx_pre_popup_menu_hook,
|
||||
doc: /* Hook run before `x-popup-menu' displays a popup menu.
|
||||
|
@ -1622,6 +1629,11 @@ won't be run if `x-popup-menu' fails or returns for some other reason
|
|||
(such as the keymap is invalid). */);
|
||||
Vx_pre_popup_menu_hook = Qnil;
|
||||
|
||||
DEFVAR_LISP ("x-popup-menu-function", Vx_popup_menu_function,
|
||||
doc: /* Function to call to pop up a menu.
|
||||
The function is called like `x-popup-menu'. */);
|
||||
Vx_popup_menu_function = Qnil;
|
||||
|
||||
defsubr (&Sx_popup_menu);
|
||||
defsubr (&Sx_popup_dialog);
|
||||
defsubr (&Smenu_bar_menu_at_x_y);
|
||||
|
|
Loading…
Add table
Reference in a new issue