Subject: 9term/9wm hacks

From: [email-masked] (Steve_Kilbane)
Date: Tue, 7 Feb 1995 07:59:20 -0500

I've been playing with some small hacks to 9term and 9wm which I
thought I'd mention to the list, since they might be of interest.
Basically, I was wondering how some of the characteristics of
8½ and Help could be implemented using the existing arrangement.
Basically I was after some level of programmability without having
to change the tools much (or do much work:-)).

In 9term, I've implemented command inputs via a pipe, similar to
the command pipe sam uses. Each 9term creates a named pipe with
the name /tmp/.9terms.$USER.$DISPLAY/$WINDOWID. Characters read
from this pipe get sent to the shell, and also appear on the
screen. The directory that the pipes are created in is mode 700,
as a nod towards security, but how safe this is, I don't know.

In 9wm, each time a window is made current the file
/tmp/.9wm-windows is re-written, containing a line for each
window. Each line contains <window label><space><windowid>.
The lines are written in the same order as the window focus
list, so the current window is the first line, the previous
current window is the second line, and so on.

>From here on in, it's just script writing. The most common
script determines which 9term was the most recently used,
and sends its arguments to that 9term's pipe. Another
script is similar, but uses xv_get_sel to determine text
that was last snarfed, and uses that in the command.

Scripts are normally run from 9menu popped up from the
main 9menu. One contains the commands used while producing
a document with latex, another has commands often used
while building an instance of the current program I'm
working on, and a third pops up the last 15 commands from
$history, for re-execution. Although I haven't done this,
9menus could be created which send commonly-used commands
to the current instance of sam (personally, I don't have
many sam commands I use a lot).

It's not a perfect system. Security is bound to be a problem,
the 9wm file should have a more unique name, and if you send
text to a 9term pipe it doesn't currently set dot first, so
the text appears in the wrong place. The command still works,
though. Finally, the hacks aren't to the most recent version
of 9term (they're to 1.3.2, and I know that matty's up to
at least 1.5).

Comments are welcome.

steve