> My script runs in the foreground but launches both the editor > and gv to run in the background.
Ah. I misunderstood. (Probably because your philosophy is somewhat different from mine -- I launch the script from the editor (not the other way around), and the editor is "blocked" until the script terminates, so this kind of thing can't happen.) But now I'm wondering: how does the editor communicate with the script, i.e., how does the script know when you've pressed the "save" button? (Apart from the script simply polling the file in regular intervals, which either wastes CPU time (not too much of an issue these days) or makes you wait unnecessarily until the next update.) Anyway, you might try to minimize the chances of the editor overwriting the file at the wrong moment by inserting a step which completes much faster than groffing the file, like perhaps pulling a copy, or renaming the file, or maybe making it read-only during processing, but your editor might not like this, so it's probably not worth the trouble. I think I'll agree with Ted -- this is mostly an academic issue, since no permanent harm is being done by "saving at the wrong time".
