emacs-devel
[Top][All Lists]
Advanced

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

Re: Context menus and mouse-3


From: Ergus
Subject: Re: Context menus and mouse-3
Date: Mon, 19 Jul 2021 21:59:43 +0200
User-agent: K-9 Mail for Android

Hi Juri:

is there anything to test, a scratch o feature branch? I am very interested in this feature.

On July 19, 2021 5:55:57 PM GMT+02:00, Juri Linkov <juri@linkov.net> wrote:
The idea is to define a variable (something like below;
poplife-menu-candidates) with list of functions that returns nil or
keymap (something like below; poplife-mouse-word-menu). A function
(something like below; poplife-context-menu) will test each of them
until it gets keymap.

Note: such a variable should have a name that ends in `-hook` or
`-functions` and should be manipulated with the usual hook functions,
e.g. `run-hook-wrapped`.

Note also that the `context-menu-function` already mentioned offers the
same kind of functionality (except you need to use `add-function`
instead of `add-hook` and it offers a bit more flexibility at the cost
of extra work).

For easier customization, 'context-menu-functions' could be more hook-like,
so e.g. when the default value will be defined as

(defcustom context-menu-functions '(context-menu-region)

then users could easily customize the default value.
More minor modes could add own functions to the global value, e.g.

(add-hook 'context-menu-functions 'bug-reference-context-menu -5)
(add-hook 'context-menu-functions 'goto-address-context-menu -10)

Major modes could modify buffer-local values:

(add-hook 'context-menu-functions 'dired-context-menu nil t)
(add-hook 'context-menu-functions 'info-context-menu -5 t)
(add-hook 'context-menu-functions 'dictionary-context-menu -10 t)

Then the user could have the final say by using another option, e.g.

(defcustom context-menu-filter nil

where a user-defined function (that can be extended using `add-function`)
will accept a menu constructed by context-menu-functions
and return the modified menu with reordered/removed/added items
to user's liking.


--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
reply via email to

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