all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: add a tooltip and a mouse binding to the VC mode-line entry
Date: Thu, 05 Jul 2007 08:45:28 -0700	[thread overview]
Message-ID: <200707051545.l65FjSgW019871@oogie-boogie.ics.uci.edu> (raw)
In-Reply-To: E1I5vmS-0001ir-Vu@fencepost.gnu.org


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))

  parent reply	other threads:[~2007-07-05 15:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-03 17:11 add a tooltip and a mouse binding to the VC mode-line entry Dan Nicolaescu
2007-07-04  3:43 ` Richard Stallman
2007-07-04  7:04   ` David Kastrup
2007-07-05  1:30     ` Richard Stallman
2007-07-04  9:47   ` Dan Nicolaescu
2007-07-05 15:45   ` Dan Nicolaescu [this message]
2007-07-05 17:13     ` Stefan Monnier
2007-07-06  5:06     ` Masatake YAMATO
2007-07-06 16:01       ` Stefan Monnier
2007-07-11 18:39         ` Dan Nicolaescu
2007-07-09 17:48       ` Dan Nicolaescu
2007-07-10  5:38         ` Richard Stallman
2007-07-04  6:06 ` Masatake YAMATO

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200707051545.l65FjSgW019871@oogie-boogie.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.