emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master dd7d966: Don't show menu titles with the text property 'hide' (bu


From: Juri Linkov
Subject: master dd7d966: Don't show menu titles with the text property 'hide' (bug#50067)
Date: Sun, 22 Aug 2021 04:46:50 -0400 (EDT)

branch: master
commit dd7d966eb40b58a221ea29930582b8173ea87ee2
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    Don't show menu titles with the text property 'hide' (bug#50067)
    
    * 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 | 2 +-
 src/menu.c    | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 3441a47..7cdea34 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -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))
diff --git a/src/menu.c b/src/menu.c
index e441d22..4edd4ce 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;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]