From 7e4e9c66183a2a9b8dd16d1b0b3fc2d177b7393d Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 19 Oct 2007 02:14:58 +0000 Subject: [PATCH] (mouse-minor-mode-menu, minor-mode-menu-from-indicator): Move here from bindings.el --- lisp/ChangeLog | 7 +++++++ lisp/mouse.el | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 22868b19c03..c24221fa8cc 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2007-10-19 Glenn Morris + + * bindings.el (mouse-minor-mode-menu) + (minor-mode-menu-from-indicator): Move to mouse.el. + * mouse.el (mouse-minor-mode-menu, minor-mode-menu-from-indicator): + Move here from bindings.el + 2007-10-19 Richard Stallman * help-fns.el (describe-function-1): Don't use the advice origname diff --git a/lisp/mouse.el b/lisp/mouse.el index 27c5dd901f7..82d12ccbdd0 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -151,6 +151,26 @@ PREFIX is the prefix argument (if any) to pass to the command." ;; mouse-major-mode-menu was using `command-execute' instead. (call-interactively cmd)))) +(defun minor-mode-menu-from-indicator (indicator) + "Show menu, if any, for minor mode specified by INDICATOR. +Interactively, INDICATOR is read using completion." + (interactive (list (completing-read "Minor mode indicator: " + (describe-minor-mode-completion-table-for-indicator)))) + (let ((minor-mode (lookup-minor-mode-from-indicator indicator))) + (if minor-mode + (let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist))) + (menu (and (keymapp map) (lookup-key map [menu-bar])))) + (if menu + (popup-menu menu) + (message "No menu for minor mode `%s'" minor-mode))) + (error "Cannot find minor mode for `%s'" indicator)))) + +(defun mouse-minor-mode-menu (event) + "Show minor-mode menu for EVENT on minor modes area of the mode line." + (interactive "@e") + (let ((indicator (car (nth 4 (car (cdr event)))))) + (minor-mode-menu-from-indicator indicator))) + (defvar mouse-major-mode-menu-prefix) ; dynamically bound (defun mouse-major-mode-menu (event &optional prefix) -- 2.39.2