|
|
1.1 root 1: NOTE: the Free Software Foundation agreed to put this file, and the
2: programs it describes, into the Emacs distribution ONLY on the
3: condition that we would not lift a finger to maintain them! We are
4: willing to *pass along* support for Sun windows, but we are not
5: willing to let it distract us from what we are trying to do. If you
6: have complaints or suggestions about Sun windows support, send them to
7: [email protected], who is the maintainer.
8:
9:
10: The interface between GNU Emacs and Sun windows consists of the program
11: etc/emacstool, the Lisp programs lisp/sun-*.el and lisp/term/sun.el,
12: and the C source file src/sunfns.c. It is documented with a man page,
13: etc/emacstool.1.
14:
15: To enable use of these files and programs, define the configuration
16: switch HAVE_SUN_WINDOWS in src/config.h before compiling Emacs.
17: The definition of HAVE_SUN_WINDOWS must precede the #include m-sun3.h
18: or #include m-sun4.h.
19: If you must change PURESIZE, do so after the #include m-sun3.h
20:
21: This software is based on SunView for Sun UNIX 4.2 Release 3.2,
22: and will not work "as is" on previous releases, eg 3.0 or 3.1.
23:
24: Using Emacstool with GNU Emacs:
25:
26: The GNU Emacs files lisp/term/sun.el, lisp/sun-mouse.el,
27: lisp/sun-fns.el, and src/sunfns.c provide emacs support for the
28: Emacstool and function keys. If your terminal type is SUN (that is,
29: if your environment variable TERM is set to SUN), then Emacs will
30: automatically load the file lisp/term/sun.el. This, in turn, will
31: ensure that sun-mouse.el is autoloaded when any mouse events are
32: detected. It is suggested that sun-mouse and sun-fns be
33: included in your site-init.el file, so that they will always be loaded
34: when running on a Sun workstation. [Increase PURESIZE to 154000].
35:
36: Support for the Sun function keys requires disconnecting the standard
37: Emacs command Meta-[. Therefore, the function keys are supported only
38: if you do (setq sun-esc-bracket t) in your .emacs file.
39:
40: The file src/sunfns.c defines several useful functions for emacs on
41: the Sun. Among these are procedures to pop-up SunView menus, put and
42: get from the SunView selection [STUFF] buffer, and a procedure for
43: changing the cursor icon. If you want to define cursor icons, try
44: using the functions in lisp/sun-cursors.el.
45:
46: The file lisp/sun-mouse.el includes a mass of software for defining
47: bindings for mouse events. Any function can be called or any form
48: evaluated as a result of a mouse event. If you want a pop-up menu,
49: your function can call sun-menu-evaluate. This will bring up a
50: SunView walking menu of your choice.
51:
52: Use the macro (defmenu menu-name &rest menu-items) to define menu
53: objects. Each menu item is a cons of ("string" . VALUE), VALUE is
54: evaluated when the string item is picked. If VALUE is a menu, then a
55: pullright item is created.
56:
57: This version also includes support for copying to and from the
58: sun-windows "stuff" selection. The keyboard bindings defined in
59: lisp/sun-fns.el let you move the current region to the "STUFF"
60: selection and vice versa. Just set point with the left button, set
61: mark with the middle button, (the region is automatically copied to
62: "STUFF") then switch to a shelltool, and "Stuff" will work. Going the
63: other way, the main right button menu contains a "Stuff Selection"
64: command that works just like in shelltool. [The Get and Put function
65: keys are also assigned to these functions, so you don't need the mouse
66: or even emacstool to make this work.]
67:
68: Until someone write code to read the textsw "Selection Shelf", it is
69: not possible to copy directly from a textsw to emacs, you must go through
70: the textsw "STUFF" selection.
71:
72: The Scroll-bar region is not a SunView scrollbar. It really should
73: be called the "Right-Margin" region. The scroll bar region is basically
74: the rightmost five columns (see documentation on variable scrollbar-width).
75: Mouse hits in this region can have special bindings, currently those binding
76: effect scrolling of the window, and so are refered to as the "Scroll-bar"
77: region.
78:
79: For information on what mouse bindings are in effect, use the command
80: M-x Describe-mouse-bindings, or the quick pop-up menu item "Mouse-Help".
81:
82:
83: GNU Emacs EXAMPLES:
84: See definitions in lisp/sun-fns.el for examples.
85:
86: You can redefine the cursor that is displayed in the emacs window.
87: On initialization, it is set to a right arrow. See lisp/sun-cursors.el
88: for additional cursors, how to define them, how to edit them.
89:
90: BUGS:
91: It takes a few milliseconds to create a menu before it pops up.
92: Someone who understands the GNU Garbage Collector might see if it
93: is possible for defmenu to create a SunView menu struct that does
94: not get destroyed by Garbage Collection.
95:
96: An outline of the files used to support Sun Windows and the mouse.
97:
98: etc/SUN-SUPPORT.
99: This document.
100:
101: etc/emacstool.1:
102: Added: an nroff'able man page for emacstool.
103:
104: etc/emacstool.c:
105: Encodes all the function keys internally, and passes non-window
106: system arguments to emacs.
107:
108: etc/emacs.icon:
109: The "Kitchen Sink" GNU Emacs icon.
110:
111: src/sunfns.c:
112: This contains the auxilary functions that allow elisp code to interact
113: with the sunwindows, selection, and menu functions.
114:
115: lisp/sun-mouse.el:
116: Defines the lisp function which is called when a mouse hit is found
117: in the input queue. This handler decodes the mouse hit via a keymap-like
118: structure sensitive to a particular window and where in the window the
119: hit occured (text-region, right-margin, mode-line). Three variables
120: are bound (*mouse-window* *mouse-x* *mouse-y*) and the selected function
121: is called.
122: See documentation on "define-mouse" or look at lisp/sun-fns.el
123: to see how this is done.
124: Defines two functions to pass between region and sun-selection
125: Defines functions for interfacing with the Menu.
126: During menu evaluation, the variables *menu-window* *menu-x* *menu-y* are bound.
127:
128: lisp/sun-fns.el
129: The definition of the default menu and mouse function bindings.
130:
131: lisp/sun-cursors.el
132: Defines a number of alternate cursors, and an editor for them.
133: The editor is also a demonstration of mouse/menu utilization.
134:
135: lisp/term/sun.el
136: Sets up the keymap to make the sun function keys do useful things.
137: Also includes the setup/initialization code for running under emacstool,
138: which makes "\C-Z" just close the emacstool window (-WI emacs.icon).
139:
140: Jeff Peck, Sun Microsystems, Inc <[email protected]>
141:
142:
143: Subject: Making multi-line scrolling really work:
144:
145: In your .defaults file, include the line:
146: /Tty/Retained "Yes"
147: That way, the terminal emulator can do text moves using bitblt,
148: instead of repaint.
149:
150: If that's not enough for you, then tell unix and emacs that
151: the sun terminal supports multi-line and multi-character insert/delete.
152: Add this patch to your /etc/termcap file:
153:
154: *** /etc/termcap.~1~ Mon Sep 15 12:34:23 1986
155: --- /etc/termcap Mon Feb 9 17:34:08 1987
156: ***************
157: *** 32,39 ****
158: --- 32,40 ----
159: Mu|sun|Sun Microsystems Workstation console:\
160: :am:bs:km:mi:ms:pt:li#34:co#80:cl=^L:cm=\E[%i%d;%dH:\
161: :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:rs=\E[s:\
162: :al=\E[L:dl=\E[M:im=:ei=:ic=\E[@:dc=\E[P:\
163: + :AL=\E[%dL:DL=\E[%dM:IC=\E[%d@:DC=\E[%dP:\
164: :up=\E[A:nd=\E[C:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:\
165: :k1=\E[224z:k2=\E[225z:k3=\E[226z:k4=\E[227z:k5=\E[228z:\
166: :k6=\E[229z:k7=\E[230z:k8=\E[231z:k9=\E[232z:
167: M-|sun-nic|sune|Sun Microsystems Workstation console without insert character:\
168:
169:
170: If you don't have the program "patch", just add the line:
171: :AL=\E[%dL:DL=\E[%dM:IC=\E[%d@:DC=\E[%dP:\
172:
173: [email protected] says:
174:
175: Those of you using GNU Emacs on Sun workstations under
176: 3.2 may be interested in reducing memory utilization in
177: the emacstool via the Sun toolmerge facility. The technique
178: is described in the Release 3.2 Manual starting on page
179: 71. The following is a summary of how it would apply
180: to merging emacstool into the basetools.
181:
182: 1) Change the main procedure declaration in emacstool.c to:
183:
184: #ifdef SUN_TOOLMERGE
185: emacstool_main (argc, argv);
186: #else
187: main (argc, argv)
188: #endif
189:
190: This will allow creation of either standard or toolmerge
191: versions.
192:
193: 2) Copy emacstool.o into directory /usr/src/sun/suntool.
194: 3) make CFLAGS="-g -DSUN_TOOLMERGE" emacstool.o
195: 4) Add the following line to basetools.h
196:
197: "emacstool",emacstool_main,
198:
199: 5) Add the following line to toolmerge.c.
200:
201: extern emacstool_main();
202:
203: 6) make basetools MOREOBJS="emacstool.o"
204: 7) make install_bins
205:
206: To invoke the toolmerged version, you must exit suntools and
207: re-start it. Make sure that /usr/bin occurs before the directory
208: in which you installed the standard (non-toolmerged) version.
209:
210:
211: Subject: Moving selections between OW and Emacstool/xvetool
212: Date: Wed, 26 Jun 91 18:58:24 PDT
213: From: Jeff Peck <peck>
214:
215: The short answer is that we can Cut and Paste between Emacstool
216: and TTYSW (shelltool) and we can Paste between Emacstool and TEXTSW(cmdtool)
217: and somewhat more slowly move from TEXTSW to Emacstool.
218:
219: **** This interaction with the TTYSW selection is a HACK! ****
220:
221: At end of this message is the code that should be in your sun-mouse.el or .emacs
222:
223: Here's the restrictions on using it:
224:
225: 1. from Shelltool to Emacstool:
226: select text in shelltool and hit COPY.
227: move to Emacstool, hit PASTE. (simple, eh?)
228:
229: For any other movement, you must remember this:
230: "The window system must believe that a shelltool has the current selection."
231: If you do that, then this will all work painlessly.
232: [that will also explain why you can not make a selection in a cmdtool
233: and then directly PASTE it into Emacstool]
234:
235: 2. from Emacstool to Shelltool
236: ensure that a shelltool has the selection: (select something and hit COPY)
237: in emacstool select a region and hit COPY
238: in shelltool hit PASTE. (not too bad, yet)
239:
240: 3. from Emacstool to Cmdtool
241: ensure that a shelltool has the selection:
242: (in a *shelltool* select something and hit COPY)
243: in emacstool select a region and hit COPY
244: in shelltool hit PASTE. (ok, its getting crufty)
245:
246: 4. from Cmdtool to Emacstool
247: select in Cmdtool, hit COPY
248: in a shelltool, % cat > /dev/null
249: then hit PASTE
250: Select the text again, from the shelltool this time. hit COPY
251: in emacstool, hit PASTE
252:
253: 4a. from Cmdtool (or shelltool) to Emacstool
254: the function "sunview-yank-any-selection" should be bound to Meta-PASTE
255: If so, then just:
256: select in Cmdtool
257: in emacstool, hit Meta-PASTE
258:
259: This uses the function "sunview-yank-current-selection"
260: which relies one the (supported) utility "get_selection"
261: As such, it is *not* a hack, but it *IS* SLOW (or slower)
262:
263:
264: If you know that a shelltool *still* has the selection
265: (note: nothing you do with Emacstool or the PASTE key will affect that)
266: then the "ensure..." line is a NO-OP.
267:
268: Note that using COPY in emacstool will change the *value* of the selection
269: behind the window systems back:
270: the holder of the selection doesn't know of this,
271: the window system doesn't know of this,
272: and the highlighted text *WILL NOT CHANGE*
273:
274: Turns out the selection value is written into a /tmp/ttyselection file
275: and emacs just rewrites that file, clever, eh?
276:
277:
278: Your version of sun-mouse.el should include these functions
279: (or put them into your .emacs)
280:
281:
282: ;;; define the selection file used by this emacs
283: ;;; if not local machine, then automounter must find /net/<host>/tmp
284: (defconst owselectionfile
285: (let ((display (getenv "DISPLAY")))
286: (if (null display)
287: nil ; no DISPLAY variable -- return nil
288: (let ((colon_at (string-match ":" display)))
289: (if (null colon_at)
290: nil ; no colon in environment variable -- return nil
291: (if (zerop colon_at)
292: "/tmp/ttyselection" ; colon is first character
293: (concat "/net/" (substring display 0 colon_at) "/tmp/ttyselection")
294: )))))
295: )
296:
297: (defun xv-yank-selection ()
298: "Set mark and yank the contents of the current Xview selection
299: into the current buffer at point. The STUFF selection contains the currently
300: or previously highlighted text from a TTYSW."
301: (interactive "*")
302: (insert-file owselectionfile)
303: (exchange-point-and-mark)
304: )
305:
306: (defun xv-select-region (beg end)
307: "Set the TTYSW selection to the region in the current buffer."
308: (interactive "r")
309: (write-region beg end owselectionfile nil 'noprint)
310: )
311:
312: You can then bind these to Copy and Paste in your .emacs
313:
314: (setq suntool-map-hooks '( ; not your usual hook list
315: (define-key suntool-map "fl" 'xv-select-region) ; L6 Copy
316: (define-key suntool-map "hl" 'xv-yank-selection) ; L8 Paste
317: )
318: )
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.