GNU bug report logs - #50067
Context menus

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sun, 15 Aug 2021 08:52:01 UTC

Severity: normal

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: alan <at> idiocy.org, mattiase <at> acm.org, homeros.misasa <at> gmail.com, tkk <at> misasa.okayama-u.ac.jp, larsi <at> gnus.org, 50067 <at> debbugs.gnu.org
Subject: bug#50067: Context menus
Date: Fri, 20 Aug 2021 19:36:58 +0300
[Message part 1 (text/plain, inline)]
>> An example of such menu is mouse-buffer-menu bound to C-<down-mouse-1>
>> where the user might wonder what do these menu items with mode names mean?
>
> OK, but I still don't think I fully understand how context menus are
> different.  Are we sure the user will immediately understand the
> purpose of the context menus, but not of a buffer-menu?

Context menus displayed up by down-mouse-3 are ubiquitous nowadays,
they are everywhere, and the users expect them without a title,
unlike Emacs-specific menus unfamiliar to most users.

>> Using a text property would be a good solution.  Should then
>> the NS-specific "Select" title be removed in menu.c
>> when the title has a special text property?
>
> I'm not sure I understand what is the NS-specific "Select" title.  Can
> you point me to the relevant code?

I meant such patch:

[context-menu-title.patch (text/x-diff, inline)]
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  */

This bug report was last modified 3 years and 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.