Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!umix!utah-gr!spline!thomas
From: thomas%spline.uucp@utah-gr.UUCP (Spencer W. Thomas)
Newsgroups: comp.emacs
Subject: Re: rebinding x mouse bindings
Message-ID: <2247@utah-gr.UUCP>
Date: Fri, 27-Nov-87 17:37:49 EST
Article-I.D.: utah-gr.2247
Posted: Fri Nov 27 17:37:49 1987
Date-Received: Sun, 29-Nov-87 23:36:52 EST
References: <1987Nov25.112019.4414@jarvis.csri.toronto.edu>
Sender: news@utah-gr.UUCP
Reply-To: thomas%spline.UUCP@utah-gr.UUCP (Spencer W. Thomas)
Organization: Univ of Utah CS Dept
Lines: 55

Well, when I made a modified x mouse binding file, I just loaded it
explicitly in my .emacs file.  This way it was already around when
x-popup-window was executed.  (You have to make sure to provide
'x-mouse in your modified file.)

(if (eq window-system 'x)
    (load "utah/xmouse-fns"))

Now that I have your attention -- a few words on my X mouse binding
package.  What I did was to take a Sun mouse package and hack on it
until it works under X (adding functionality, of course).  The nice
thing about this package is that it provides orthogonal key binding --
that is, you can define an action based on button, modifier(s), screen
location, and click vs. drag.  (The original Sun package had double
click, but I couldn't figure out how to get a timestamp on mouse
clicks, so I bagged that.)  For example, here are my default bindings:

      (global-set-mouse '(left text) 'x-mouse-mark-and-point)
      (global-set-mouse '(middle text) 'x-mouse-yank)
      (global-set-mouse '(right text) 'x-mouse-select-window)

      (global-set-mouse '(left drag text) 'x-mouse-copy-region)
      (global-set-mouse '(middle drag text) 'x-mouse-kill-region)
      (global-set-mouse '(right drag text) 'x-mouse-indent-region)

      (global-set-mouse '(left shift text) 'x-mouse-re-enter-line)
      (global-set-mouse '(right shift text) 'x-mouse-insert-cut)

      (global-set-mouse '(middle shift drag text) 'x-mouse-cut)

      (global-set-mouse '(left modeline) 'x-mouse-scroll-down)
      (global-set-mouse '(middle modeline) 'x-mouse-invoke-buffer-menu)
      (global-set-mouse '(right modeline) 'x-mouse-scroll-up)

      (global-set-mouse '(left shift modeline) 'x-mouse-beginning-of-defun)
      (global-set-mouse '(right shift modeline) 'x-mouse-end-of-defun)

      (global-set-mouse '(left drag modeline) 'x-mouse-resize)
      (global-set-mouse '(middle drag modeline) 'x-mouse-split)

      (global-set-mouse '(left scrollbar) 'x-mouse-line-to-bottom)
      (global-set-mouse '(middle scrollbar) 'x-mouse-scroll-up-down)
      (global-set-mouse '(right scrollbar) 'x-mouse-line-to-top)

      (global-set-mouse '(middle scrollbar drag) 'x-mouse-drag-scroll)

The individual functions are (relatively) easy to write, too.

The next step is to see what is necessary to make it window system
independent (except for a system dependent dispatching function), so
you can get the same mouse bindings no matter what system you are using.

If enough people are interested, I could post it.

=Spencer   ({ihnp4,decvax}!utah-cs!thomas, thomas@cs.utah.edu)