]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't show menu titles with the text property 'hide' (bug#50067)
authorJuri Linkov <juri@linkov.net>
Sun, 22 Aug 2021 08:44:55 +0000 (11:44 +0300)
committerJuri Linkov <juri@linkov.net>
Sun, 22 Aug 2021 08:46:08 +0000 (11:46 +0300)
* lisp/mouse.el (context-menu-map): Add menu title "Context Menu"
propertized with the text property 'hide'.

* src/menu.c (x_popup_menu_1): Don't show the title with the non-nil
text property 'hide' on GTK and NS.

lisp/mouse.el
src/menu.c

index 3441a4787e61d41e697a84aa43763632106b2f3a..7cdea34d8653d20bd6b133bf3b23ef6c7227ab8a 100644 (file)
@@ -304,7 +304,7 @@ the same menu with changes such as added new menu items."
 
 (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))
index e441d22ea0462c3c1011989227dbbbfc5d766c5a..4edd4ce33f9155f16f33de98259d17f7fb361ae1 100644 (file)
@@ -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;