[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/mouse.el,v
From: |
Dan Nicolaescu |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/mouse.el,v |
Date: |
Thu, 21 Feb 2008 09:15:35 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Dan Nicolaescu <dann> 08/02/21 09:15:34
Index: mouse.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mouse.el,v
retrieving revision 1.327
retrieving revision 1.328
diff -u -b -r1.327 -r1.328
--- mouse.el 7 Feb 2008 06:20:25 -0000 1.327
+++ mouse.el 21 Feb 2008 09:15:32 -0000 1.328
@@ -152,18 +152,33 @@
(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: "
+ "Show menu for minor mode specified by INDICATOR.
+Interactively, INDICATOR is read using completion.
+If there is no menu defined for the minor mode, then create one with
+items `Turn Off' and `Help'."
+ (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
+ (unless minor-mode (error "Cannot find minor mode for `%s'" indicator))
(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))))
+ (unless menu
+ (setq menu
+ `(keymap
+ (,(intern indicator) ,indicator
+ keymap
+ (turn-off menu-item "Turn Off minor mode"
+ (lambda ()
+ (interactive)
+ (,minor-mode -1)
+ (message ,(format "`%S' turned OFF" minor-mode))))
+ (help menu-item "Help for minor mode"
+ (lambda () (interactive)
+ (describe-function
+ ',minor-mode)))))))
+ (popup-menu menu))))
(defun mouse-minor-mode-menu (event)
"Show minor-mode menu for EVENT on minor modes area of the mode line."