diff options
| author | Richard M. Stallman | 2002-07-02 18:49:03 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-07-02 18:49:03 +0000 |
| commit | 89fd3098d88e6e2f41bd56a0629f609f02b6c42f (patch) | |
| tree | e7bcdd5d60aa916e469d1806733f24f1fc88c0b4 | |
| parent | 4795d1c7d19313b7313dcc21c52eaf3e168cf77c (diff) | |
| download | emacs-89fd3098d88e6e2f41bd56a0629f609f02b6c42f.tar.gz emacs-89fd3098d88e6e2f41bd56a0629f609f02b6c42f.zip | |
(easy-menu-popup-menu): New function.
| -rw-r--r-- | lisp/emacs-lisp/easymenu.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index bf2e190e489..045a5590699 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el | |||
| @@ -616,6 +616,20 @@ In some cases we use that to select between the local and global maps." | |||
| 616 | (or (keymapp map) (error "Malformed menu in easy-menu: (%s)" map)) | 616 | (or (keymapp map) (error "Malformed menu in easy-menu: (%s)" map)) |
| 617 | map) | 617 | map) |
| 618 | 618 | ||
| 619 | (defun easy-menu-popup-menu (menu &optional event) | ||
| 620 | "Pop up a menu and run a command according to user's selection. | ||
| 621 | MENU is a menu description as in `easy-menu-define'. | ||
| 622 | EVENT is a mouse button event and determines where to pop up the menu. | ||
| 623 | If EVENT is nil, pop up menu at the current mouse position." | ||
| 624 | (let ((map (easy-menu-create-menu (car menu) (cdr menu)))) | ||
| 625 | (if (symbolp map) | ||
| 626 | (let ((f (memq :filter (get map 'menu-prop)))) | ||
| 627 | (setq map (symbol-function map)) | ||
| 628 | (if f (setq map (funcall (cadr f) map))))) | ||
| 629 | (let* ((sel (x-popup-menu (or event t) map)) | ||
| 630 | (f (if (consp sel) (lookup-key map (apply 'vector sel))))) | ||
| 631 | (if (commandp f) (call-interactively f))))) | ||
| 632 | |||
| 619 | (provide 'easymenu) | 633 | (provide 'easymenu) |
| 620 | 634 | ||
| 621 | ;;; easymenu.el ends here | 635 | ;;; easymenu.el ends here |