[comp.emacs] rebinding x mouse bindings

lamy@ai.toronto.edu.UUCP (11/25/87)

GNU emacs 18.44.1's support for X has the flaw that it forcibly redefines
term-setup-hook to be x-popup-window.  The obvious fix is to redefine it
to (funcall term-setup-hook) followed by the (x-popup-window).

Or is there another, proper, way to get customized mouse bindings that I have
missed short of putting them in term-setup-hook and fixing x-win.el?

Jean-Francois Lamy	               lamy@ai.toronto.edu  lamy@ai.toronto.cdn
AI Group, Dept of Computer Science     uunet!ai.toronto.edu!lamy
University of Toronto                  lamy%ai.toronto.edu@relay.cs.net (arpa)
Toronto, Canada M5S 1A4	               lamy@ai.utoronto, lamy@utorgpu (bitnet)

thomas%spline.uucp@utah-gr.UUCP (Spencer W. Thomas) (01/21/88)

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)