diff --git a/lisp/mouse.el b/lisp/mouse.el index d2a5200d8d..f9355b4f73 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -304,7 +304,7 @@ context-menu-filter-function (defun context-menu-map () "Return composite menu map." - (let ((menu (make-sparse-keymap))) + (let ((menu (make-sparse-keymap (propertize "Context Menu" 'hide t)))) (run-hook-wrapped 'context-menu-functions (lambda (fun) (setq menu (funcall fun menu)) diff --git a/src/menu.c b/src/menu.c index 3b1d740257..6654c47c93 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1284,6 +1284,14 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu) /* Search for a string appearing directly as an element of the keymap. That string is the title of the menu. */ prompt = Fkeymap_prompt (keymap); + +#if defined (USE_GTK) || defined (HAVE_NS) + if (STRINGP (prompt) + && SCHARS (prompt) > 0 + && !NILP (Fget_text_property (make_fixnum (0), Qhide, prompt))) + title = Qnil; + else +#endif if (!NILP (prompt)) title = prompt; #ifdef HAVE_NS /* Is that needed and NS-specific? --Stef */