[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: add a tooltip and a mouse binding to the VC mode-line entry
From: |
Dan Nicolaescu |
Subject: |
Re: add a tooltip and a mouse binding to the VC mode-line entry |
Date: |
Thu, 05 Jul 2007 08:45:28 -0700 |
Here's a little patch that adds a tooltip to the VC entry on the
mode line and it also makes mouse-1 on that entry to pop up the VC
operations menu.
It would be good if people would try it and say if it useful based on
_actual usage experience_, not just speculation. After that we can
change the text for the tooltip, add more mouse bindings or even
decide not to install the whole thing.
Index: lisp/mouse.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mouse.el,v
retrieving revision 1.316
diff -u -r1.316 mouse.el
--- lisp/mouse.el 20 Jun 2007 07:55:25 -0000 1.316
+++ lisp/mouse.el 5 Jul 2007 15:27:09 -0000
@@ -181,6 +181,18 @@
(popup-menu newmap event prefix)))
+(defun mouse-vc-mode-menu (event &optional prefix)
+ "Pop up a menu for VC commands."
+ ;; Switch to the window clicked on, because otherwise
+ ;; the mode's commands may not make sense.
+ (interactive "@e\nP")
+ ;; Let the mode update its menus first.
+ (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
+ (let* ((newmap (make-sparse-keymap)))
+ (set-keymap-parent newmap vc-menu-map)
+ (popup-menu newmap event prefix)))
+
+
;; Compute and cache the equivalent keys in MENU and all its submenus.
;;;(defun mouse-major-mode-menu-compute-equiv-keys (menu)
;;; (and (eq (car menu) 'keymap)
Index: lisp/bindings.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/bindings.el,v
retrieving revision 1.178
diff -u -r1.178 bindings.el
--- lisp/bindings.el 11 Feb 2007 22:11:48 -0000 1.178
+++ lisp/bindings.el 5 Jul 2007 15:27:49 -0000
@@ -273,3 +273,8 @@
map) "\
Keymap to display on minor modes.")
+(defvar mode-line-vc-mode-keymap
+ (let ((map (make-sparse-keymap)))
+ (define-key map [mode-line down-mouse-1] 'mouse-vc-mode-menu)
+ map) "\
+Keymap to display VC operations.")
@@ -291,7 +303,10 @@
'mode-line-buffer-identification
(propertize " " 'help-echo help-echo)
'mode-line-position
- '(vc-mode vc-mode)
+ (list
+ `(:propertize ("" vc-mode) help-echo "Version Control mouse-1: VC
menu"
+ mouse-face mode-line-highlight
+ local-map ,mode-line-vc-mode-keymap))
(propertize " " 'help-echo help-echo)
'mode-line-modes
`(which-func-mode ("" which-func-format ,dashes))
Re: add a tooltip and a mouse binding to the VC mode-line entry, Masatake YAMATO, 2007/07/04