unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* add a tooltip and a mouse binding to the VC mode-line entry
@ 2007-07-03 17:11 Dan Nicolaescu
  2007-07-04  3:43 ` Richard Stallman
  2007-07-04  6:06 ` Masatake YAMATO
  0 siblings, 2 replies; 13+ messages in thread
From: Dan Nicolaescu @ 2007-07-03 17:11 UTC (permalink / raw)
  To: emacs-devel


The VC item on  the mode-line is one of the very few that does not
have a tooltip nor does it have a mouse binding. 

A tooltip is almost always useful and it would be good if mouse-1
would invoke the Tools/Version Control menu. 

Opinions?  (Patches? :-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  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
                     ` (2 more replies)
  2007-07-04  6:06 ` Masatake YAMATO
  1 sibling, 3 replies; 13+ messages in thread
From: Richard Stallman @ 2007-07-04  3:43 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: emacs-devel

    The VC item on  the mode-line is one of the very few that does not
    have a tooltip nor does it have a mouse binding. 

We can give it a mouse binding if there is something useful for that
binding to do.  But is there anything that would be useful?  There is
no sense giving it a mouse binding just so it will have one if it
isn't a useful and natural interface.

If it doesn't have a mouse binding, it does not need a tooltip.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  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  6:06 ` Masatake YAMATO
  1 sibling, 0 replies; 13+ messages in thread
From: Masatake YAMATO @ 2007-07-04  6:06 UTC (permalink / raw)
  To: dann; +Cc: emacs-devel

> The VC item on  the mode-line is one of the very few that does not
> have a tooltip nor does it have a mouse binding. 
> 
> A tooltip is almost always useful and it would be good if mouse-1
> would invoke the Tools/Version Control menu. 
> 
> Opinions?  (Patches? :-)

I strongly agree with you. I would like to use Tools/Version Control menu 
on mode line. 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  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
  2 siblings, 1 reply; 13+ messages in thread
From: David Kastrup @ 2007-07-04  7:04 UTC (permalink / raw)
  To: rms; +Cc: Dan Nicolaescu, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     The VC item on  the mode-line is one of the very few that does not
>     have a tooltip nor does it have a mouse binding. 
>
> We can give it a mouse binding if there is something useful for that
> binding to do.  But is there anything that would be useful?

Offering to diff with some important points (recent checkins, major
branches, modified upstream) perhaps.

> There is no sense giving it a mouse binding just so it will have one
> if it isn't a useful and natural interface.
>
> If it doesn't have a mouse binding, it does not need a tooltip.

Disagreement here: the VC mode line indicators are concise, but
cryptic.  The difference between CVS-1.1 and CVS:1.1 is not clear to
many beginners.  A tooltip might help.

-- 
David Kastrup

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  2007-07-04  3:43 ` Richard Stallman
  2007-07-04  7:04   ` David Kastrup
@ 2007-07-04  9:47   ` Dan Nicolaescu
  2007-07-05 15:45   ` Dan Nicolaescu
  2 siblings, 0 replies; 13+ messages in thread
From: Dan Nicolaescu @ 2007-07-04  9:47 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

  >     The VC item on  the mode-line is one of the very few that does not
  >     have a tooltip nor does it have a mouse binding. 
  > 
  > We can give it a mouse binding if there is something useful for that
  > binding to do.  But is there anything that would be useful?  

Yes, at least displaying the VC menu when pressing mouse-1 would be
very useful. This would be consistent with displaying the major mode
menu when clicking on the major mode name on the mode line. 

  > There is no sense giving it a mouse binding just so it will have
  > one if it isn't a useful and natural interface.

The VC entry on the mode line is a brief textual representation of
version control, IMO being able to interact with the version control
system by clicking on the textual representation is a very useful and
natural interface. 

I was bored during a flight so I have actually implemented
this. Playing with a working implementation, I can say that I like how
it feels. I can post the patch, if you want me to.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  2007-07-04  7:04   ` David Kastrup
@ 2007-07-05  1:30     ` Richard Stallman
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2007-07-05  1:30 UTC (permalink / raw)
  To: David Kastrup; +Cc: dann, emacs-devel

    > We can give it a mouse binding if there is something useful for that
    > binding to do.  But is there anything that would be useful?

    Offering to diff with some important points (recent checkins, major
    branches, modified upstream) perhaps.

That doesn't seem awfully convenient as an interface.  And wouldn't
it have to consult the repository (a slow operation) to determine what
checkins and branches to include in the menu?

There is nothing wrong with having some text in the mode line that has
no special mouse command feature.  We should add such mouse commands
when they are useful and natural, not out of a desire for
completeness.

Completeness is explicitly a non-goal for Emacs development.

    > If it doesn't have a mouse binding, it does not need a tooltip.

    Disagreement here: the VC mode line indicators are concise, but
    cryptic.  The difference between CVS-1.1 and CVS:1.1 is not clear to
    many beginners.  A tooltip might help.

That is a good point.  Please add an explanatory tooltip
if you would like to.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  2007-07-04  3:43 ` Richard Stallman
  2007-07-04  7:04   ` David Kastrup
  2007-07-04  9:47   ` Dan Nicolaescu
@ 2007-07-05 15:45   ` Dan Nicolaescu
  2007-07-05 17:13     ` Stefan Monnier
  2007-07-06  5:06     ` Masatake YAMATO
  2 siblings, 2 replies; 13+ messages in thread
From: Dan Nicolaescu @ 2007-07-05 15:45 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel


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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  2007-07-05 15:45   ` Dan Nicolaescu
@ 2007-07-05 17:13     ` Stefan Monnier
  2007-07-06  5:06     ` Masatake YAMATO
  1 sibling, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2007-07-05 17:13 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: rms, emacs-devel

I believe the patch below would be pretty much equivalent, but with the
advantage that C-h k can be used on it (i.e. C-h k and then mouse-1 on the
VC thingy to select the entry you want).


        Stefan


--- menu-bar.el	08 May 2007 11:55:53 -0400	1.302
+++ menu-bar.el	05 Jul 2007 13:09:04 -0400	
@@ -1161,6 +1161,7 @@
   '("--"))
 
 (defvar vc-menu-map (make-sparse-keymap "Version Control"))
+(defalias 'vc-menu-map vc-menu-map)
 (define-key menu-bar-tools-menu [pcl-cvs]
   '(menu-item "PCL-CVS" cvs-global-menu))
 (define-key menu-bar-tools-menu [vc]

--- bindings.el	13 Feb 2007 17:39:39 -0500	1.178
+++ bindings.el	05 Jul 2007 13:07:56 -0400	
@@ -291,7 +291,13 @@
 	 '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 ,(let ((map (make-sparse-keymap)))
+                         (define-key map [mode-line down-mouse-1] 'vc-menu-map)
+                         map)))
 	 (propertize "  " 'help-echo help-echo)
 	 'mode-line-modes
 	 `(which-func-mode ("" which-func-format ,dashes))

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  2007-07-05 15:45   ` Dan Nicolaescu
  2007-07-05 17:13     ` Stefan Monnier
@ 2007-07-06  5:06     ` Masatake YAMATO
  2007-07-06 16:01       ` Stefan Monnier
  2007-07-09 17:48       ` Dan Nicolaescu
  1 sibling, 2 replies; 13+ messages in thread
From: Masatake YAMATO @ 2007-07-06  5:06 UTC (permalink / raw)
  To: dann; +Cc: rms, emacs-devel

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

Looks good. Now I can hide the menu bar:-P.

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

I think this should be done in `vc-mode-line'.
Look at `vc-default-mode-line-string'.
Telling the meaning of `:' or `-' in the tooltip string may help users.

Masatake

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  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
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2007-07-06 16:01 UTC (permalink / raw)
  To: Masatake YAMATO; +Cc: dann, rms, emacs-devel

> I think this should be done in `vc-mode-line'.
> Look at `vc-default-mode-line-string'.
> Telling the meaning of `:' or `-' in the tooltip string may help users.

Very good point.


        Stefan

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  2007-07-06  5:06     ` Masatake YAMATO
  2007-07-06 16:01       ` Stefan Monnier
@ 2007-07-09 17:48       ` Dan Nicolaescu
  2007-07-10  5:38         ` Richard Stallman
  1 sibling, 1 reply; 13+ messages in thread
From: Dan Nicolaescu @ 2007-07-09 17:48 UTC (permalink / raw)
  To: rms; +Cc: Masatake YAMATO, emacs-devel

Masatake YAMATO <jet@gyve.org> writes:

  > > 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. 
  > 
  > Looks good. Now I can hide the menu bar:-P.
  > 
  >     @@ -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))
  > 
  > I think this should be done in `vc-mode-line'.
  > Look at `vc-default-mode-line-string'.
  > Telling the meaning of `:' or `-' in the tooltip string may help users.

Can you please OK a change along these lines? All the comments on
adding this feature were positive.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  2007-07-09 17:48       ` Dan Nicolaescu
@ 2007-07-10  5:38         ` Richard Stallman
  0 siblings, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2007-07-10  5:38 UTC (permalink / raw)
  To: Dan Nicolaescu; +Cc: jet, emacs-devel

    Can you please OK a change along these lines? All the comments on
    adding this feature were positive.

I won't object.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: add a tooltip and a mouse binding to the VC mode-line entry
  2007-07-06 16:01       ` Stefan Monnier
@ 2007-07-11 18:39         ` Dan Nicolaescu
  0 siblings, 0 replies; 13+ messages in thread
From: Dan Nicolaescu @ 2007-07-11 18:39 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Masatake YAMATO, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

  > > I think this should be done in `vc-mode-line'.
  > > Look at `vc-default-mode-line-string'.
  > > Telling the meaning of `:' or `-' in the tooltip string may help users.
  > 
  > Very good point.

I committed something like this. Please feel free to improve the
wording for the tooltip. 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-07-11 18:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).