bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#62250: 29.0.60; Allow context menu from text properties to not overr


From: Eli Zaretskii
Subject: bug#62250: 29.0.60; Allow context menu from text properties to not override everything
Date: Sat, 18 Mar 2023 10:31:36 +0200

> Cc: Juri Linkov <juri@linkov.net>
> From: Augusto Stoffel <arstoffel@gmail.com>
> Date: Sat, 18 Mar 2023 08:51:21 +0100
> 
> It would be nice if the context menu defined by a text property had the
> option of adding to instead of overriding the menu specified by
> `context-menu-functions'.
> 
> I think this can be done in a backwards-compatible way as follows:
> 
> --8<---------------cut here---------------start------------->8---
> (defun context-menu-map (&optional click)
>   "Return menu map constructed for context near mouse CLICK.
> The menu is populated by calling functions from
> `context-menu-functions'.  Each function receives the menu and the mouse
> click event and returns the same menu after adding own menu items to the
> composite menu.  Alternatively, it can return a completely new menu.  In
> this case, no further functions from `context-menu-functions' are
> called.
> 
> When there is a text property `context-menu-function' at CLICK, it is
> handled as if it were the first entry of `context-menu-functions'.
> 
> At the end, it's possible to modify the final menu by specifying the
> function `context-menu-filter-function'."
> --8<---------------cut here---------------end--------------->8---

What if a Lisp program _does_ want to override the menu specified by
context-menu-functions? or what if it wants the menu specified by the
text property to be the _last_ entry, not the first?





reply via email to

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