[gnu.emacs] emacs, X Windows & Sun 386i

wilensky@dsg.ti.csc.com (01/20/89)

I am having some trouble customizing emacs running in the X Windows
environment on a Sun 386i. We are using emacs version 18.52,
X11 revision 2, and SunOS version 4.0.0. We are using the TWM window mgr.
I would appreciate any help with the following:
1. How do you map emacs functions to the left and right hand keys. For example  
   make PgUp do what ctrl-v does.
2. Can you detect double mouse clicks? Xterm seems to be able to do this but
   I can't get emacs to see them.
3. Can you highlight a marked region?
Please respond to wilensky@dsg.ti.csc.com.
Thanks.
Harold Wilensky

dave@CS.WISC.EDU (Dave Cohrs) (01/20/89)

[ Harold Wilensky -- your return address, wilensky@dsg.ti.csc.com,
  doesn't work; check with your Postmaster for a valid address ]

> 2. Can you detect double mouse clicks? Xterm seems to be able to do this but
>    I can't get emacs to see them.

It's gross, but you can do it.  Check out lisp/sun-mouse.el, which
handles mouse events under suntools, for a basic idea of the technique.

Under X11, you basically write a function to handle mouse *release*
events, and in there you:

  (sit-for wait-time)
  (if (not (= (x-mouse-events) 0))
      (setq mouse-count (1+ mouse-count))
    (setq mouse-count 0))

and mouse-count will count how many mouse events occurred within your
selected 'wait-time', one event at a time.  In the corresponding
mouse-press routine, you can do a (cond) depending on the value of
mouse-count.  I've used this technique to make a multiple click
detector that lets me mark characters, words or lines.  I'd send it
along, but it's not fit for public distribution.  If you have
HAVE_SUN_WINDOWS defined, you can also use (sit-for-millisecs) instead
of (sit-for).  Here's an tangential question:

	Why is (sit-for-millisecs) part of the sun-windows support?
	It obviously has more general uses.  I would think it belongs
	in some general area, along with (sit-for).  On OS's that
	can't support it, it could just act like (sit-for).

This is basically the same way xterm detects multiple clicks.

> 3. Can you highlight a marked region?

I don't think so.  People are *often* asking about such support on
this list, not just under the X window system, but in general.  Maybe
this would be a good thing to support?  BTW -- You can't detect
mouse motion events either, without changing the C code.

Dave Cohrs