[comp.emacs] Documentation on new Emacstool and SunWindows

peck@SUN.COM (Jeff Peck) (01/21/87)


Documentation of `emacstool', an interface from Sun Windows to GNU Emacs,
    from Ian Batten.
Now modified and enhanced by Jeff Peck <peck@sun.com>

The program `emacstool' in this directory sets up a Sun window and
runs GNU Emacs in it.

Type "emacstool  &" and  away  you go!  However, you can also include
emacstool in your .suntools file if you want.  From a shell, i suggest
the idiom % (emacstool &)& to make the emacstool process detached.

Generic command-line arguments (-Wt, -Ws etc) are accepted.
  You may also include an option "-rc pathname".  This causes emacstool 
to use the specified run command instead of "emacs".  This is useful
for running alternate versions of emacs, or you can use -rc /bin/csh,
and then run emacs from that shell.
  Any arguments not claimed by emacstool or the window system are passed 
to emacs (or whatever program you run).

For example: (emacstool -rc /bin/csh emacs -l server &)&

All mouse buttons are encoded and sent to emacs as "\C-X\C-@(button x y)\n"
src/sun-mouse.el includes a mass of software for defining bindings for
mouse events.  Any function can be call or any form evaluated as a result
of a mouse event. If you want a pop-up menu, your function can call
sun-menu-evaluate. This will bring up a sunview walking menu of your choice.

Use the macro (defmenu menu-name &rest menu-items) to define menu objects.
Each menu item is a cons of ("string" . VALUE), VALUE is evaluated when
the string item is picked.  If VALUE is a menu, the a pullright item is
created.  See definitions in lisp/sun-mouse-fns.el for examples.

This version also includes support for copying to and from the sun-windows
"stuff" selection.  The bindings defined in lisp/sun-mouse-fns.el let
you move the current region to the "stuff" selection and vice versa.
Just set point with the left button, set mark with the middle button,
(the region is automatically copied to "stuff") then switch to a shelltool,
and "STUFF" will work.  Going the other way, the main right button menu
contains a "Stuff Selection" command that works just like in shelltool.
[the Get and Put function keys are also assigned to these functions,
so you don't need the mouse or even emacstool to make this work.]

You no longer need to worry about a .ttyswrc file.  Emacstool maps all
function keys to ascii escape sequences. You can pick them up with the 
usual key binding functions. See lisp/term/sun.el for examples.

You can redefine the cursor that is displayed in the emacs window, on
initialization, it is set to a right arrow. See lisp/sun-cursors.el
for addtional cursors, how to define them, how to edit them.

The menu display needs to work with sunview and there's still a few slips.
Sometimes menu picks get lost... I suggest clicking "right" outside the emacs
window to get things synchronized.

  An outline of the changes made to support the sun windows and mouse.

	Jeff Peck, Sun Microsystems, Inc		peck@sun.com


Files of the gnu distribution which are changed:
etc/SUN-SUPPORT.
    This document.

etc/emacstool.c:
    Mostly rewritten, now encodes all the function keys internally,
and passes non-window system arguments to emacs.

etc/emacs.icon:
    The "terminal" icon, with "GNU emacs" on it.

src/emacs.c:
   Inserted code to load syms_of_sunfns();

src/ymakefile:
   Added code to load SUNOBJ = sunfns.o
   Added code to load LIBSUN = -lsuntool -lsunwindow -lpixrect
These are conditioned on #ifdef sun-3

src/sunfns.c:
    This contains the auxilary functions that allow elisp code to interact
with the sunwindows, selection, and menu functions.
syms_of_sunfns()
{
  defsubr(&Ssun_window_init);
  defsubr(&Ssun_mouse_sit_for);
  defsubr(&Ssun_change_cursor_icon);
  defsubr(&Ssun_set_selection);
  defsubr(&Ssun_get_selection);
  defsubr(&Ssun_menu_internal);
}

lisp/sun-mouse.el:
    Defines the lisp function which is called when a mouse hit is found
in the input queue.  This handler decodes the mouse hit via a keymap-like
structure sensitive to a particualar window and where in the window the
hit occured (text-region, right-margin, mode-line).  Three variables
are bound (*mouse-window* *mouse-x* *mouse-y*) and the selected function
is called. 
    See documentation on "define-mouse" or look at lisp/sun-mouse-fns.el
to see how this is done.
    Defines two functions to pass between region and sun-selection
    Defines functions for interfacing with the Menu.

lisp/sun-mouse-fns.el
    The definition of the default menu and mouse function bindings.

lisp/sun-cursors.el
    Defines a number of alternate cursors, and an editor for them.

lisp/term/sun.el
    Sets up the keymap to make the sun function keys do useful things.
Also includes the setup/initialization code for running under emacstool,
which makes "\C-Z" just close the emacstool window (-WI emacs.icon).

	Jeff Peck, Sun Microsystems, Inc		peck@sun.com