[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing default mouse bindings
From: |
Tak Kunihiro |
Subject: |
Re: Changing default mouse bindings |
Date: |
Wed, 10 Jan 2018 13:34:37 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (windows-nt) |
> Maybe we could do something like the code below. The intention is to
> make it reasonably easy to add functions to the hook that add a few
> elements to the menu, and to also make it possible to add functions that
> completely override the default menu (e.g. for flyspell's context menu).
>
> (defvar mouse-context-menu-function #'mouse-default-context-menu
> "Function that builds the context-menu.
> Takes one argument (the EVENT that requests the menu) and should return
> a list of menu items.")
>
> (defun mouse-context-menu (event)
> "Open up the context menu."
> (interactive "@e")
> (let* ((menu-items (funcall mouse-context-menu-function event))
> (keymap `(keymap ,(apply #'vector menu-items))))
> (popup-menu leymap event)))
I tried to test the sample code but I cannot make it work.
Can you show me how to make it work?
(defvar mouse-context-menu-function #'mouse-default-context-menu
"Function that builds the context-menu.
Takes one argument (the EVENT that requests the menu) and should return
a list of menu items.")
(defun mouse-context-menu (event)
"Open up the context menu."
(interactive "@e")
(let* ((menu-items (funcall mouse-context-menu-function event))
(keymap `(keymap ,(apply #'vector menu-items))))
- (popup-menu leymap event)))
+ (popup-menu keymap event)))
+ (defun mouse-default-context-menu (event)
+ "Return default context menu."
+ (interactive "e")
+ menu-bar-edit-menu)
+
+ (define-key global-map [mouse-3] 'mouse-context-menu)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Changing default mouse bindings,
Tak Kunihiro <=