3 acmeevent, acme.rc \- shell script support for acme clients
7 .B acme/acme/$winid/event | acmeevent
10 \&. /usr/local/plan9/lib/acme.rc
63 make it easy to write simple
65 client programs as shell scripts.
73 for the windows they control, reacting to the events.
74 The events are presented in a format that is easy to read with C programs
75 but hard to read with shell scripts.
80 event stream from standard input, printing a shell-friendly
81 version of the events, one per line, on standard output.
102 A character indicating the origin or cause of the action.
103 The possible causes are:
104 a write to the body or tag file
106 a write to the window's other files
108 input via the keyboard
115 A character indicating the type of action.
116 The possible types are:
117 text deleted from the body
119 text deleted from the tag
121 text inserted in the body
123 text inserted in the tag
125 a button 3 action in the body
127 a button 3 action in the tag
129 a button 2 action in the body
132 a button 2 action in the tag
165 shell functions useful for writing acme clients.
168 creates a new acme window and sets
170 to the new window's id.
171 The other commands all use
173 to determine which window to operate on.
176 prints the current window's
181 .BI /mnt/acme/acme/$winid/ file
185 writes standard input to the current window's
190 are useful mainly in building more complex functions.
198 The most commonly-used command is
200 which marks the window as clean.
203 for a full list of commands.
206 sets the window's dump directory
210 If either argument is omitted or is
212 that argument is not set.
215 sets the name displayed in the window's tag.
220 command. If the argument
222 is given, it simulates the
227 writes an event to the window's event file.
228 The event is in the format produced by
230 Only the first four arguments are necessary:
231 the rest are ignored.
232 Event handlers should call
234 to pass unhandled button 2 or button 3 events
240 executes the current window's event file, as output by
242 It returns when the window has been deleted.
245 clients must define a shell function named
247 which will be run for each incoming event,
250 executes the output of
252 A typical event function need only worry about button 2 and button 3 events.
253 Those events not handled should be sent back to
259 a dictionary browser,
269 .ta +4n +4n +4n +4n +4n +4n
272 case Mx MX # button 2 - pass back to acme
274 case Ml ML # button 3 - open new window on dictionary or entry
277 dictwin /adict/$7/ $7
279 dictwin /adict/$dict/$7 $dict $7
285 Note that the button 3 handler starts a subshell in which to run
287 That subshell will create a new window, set its name,
288 possibly fill the window with a dictionary list or dictionary entry,
289 mark the window as clean, and run the event loop:
297 dict -d '?' >[2=1] | sed 1d | winwrite body
299 dict -d $dict $3 >[2=1] | winwrite body
305 The script starts with an initial window:
311 Button 3 clicking on a dictionary name in the initial window
312 will create a new empty window for that dictionary.
313 Typing and button 3 clicking on a word in that window
314 will create a new window with the dictionary's entry for that word.
317 .B /usr/local/plan9/bin/adict
318 for the full implementation.
320 .B /usr/local/plan9/src/cmd/acmeevent.c
322 .B /usr/local/plan9/lib/acme.rc
328 There is more that could be done to ease the writing
329 of complicated clients.