On 20-Aug-07 17:58:24, Gunnar Ritter wrote: > (Ted Harding) <[EMAIL PROTECTED]> wrote: > >> The loop constantly checks whether the timestamp on myfile.tr >> is more recent than that of myfile.watch and, if it is, then >> groff is run on myfile.tr to generate myfile.ps, and then a >> 'kill -1' is sent to 'gv' so that it re-reads myfile.ps and >> displays the formatted version of the latest save. Then the >> file myfile.watch is again 'touh'ed. > > Why do you not simply use the "Watch file" feature of gv (in > the "State" menu?
That's what I first did, when I developed the method years ago. But sending 'gc' a SIGHUP (-1) is quicker. Also, the way the loop is written avoids the sort of problem you describe -- it has evolved over time to avoid treading on its own shoelaces! I think it is now trip-proof. Presumably your Makefile script takes similar precuations. It's just a different way to do it, I suppose. And I'm used to "ESC:w" as the "trigger" keystrokes (I suppose I could plant them under F6, though). Thanks for your contribution, though! Ted. > This is what I do. I edit the file in vi (actually in vim, > since syntax highlighting makes reading troff code much more > comfortable). > > In my .exrc/.vimrc, I have a command > > map #6 :w^M:!make^M^M^M > > (type ^M as ctrl-v ctrl-m). Then when I type F6, vi/vim > saves the file and invokes make. make, in turn, calls troff > to re-generate the PostScript document. Thanks to "Watch > file", gv automatically notices that it has changed, and > displays it again. > > Thus, all what is necessary to update the display is to > type F6. > > The only more tricky aspect is the Makefile. The problem > is that gv must not update its display until the PostScript > data has been written completely. Thus, I usually have > statements like > > .SUFFIXES: .tr .ps > > .tr.ps: > rm -f $@; trap "rm -f $$$$.ps" 0 2 3; \ > tbl $< | eqn | troff | dpost >$$$$.ps && mv $$$$.ps $@ > > all: doc.ps > > clean: > rm -f doc.ps > > in it, but you can of course replace them by any troff > pipeline you need. > > I also have templates for Makefiles and troff input for > any type of document I usually write. Thus, I rarely > write new troff Makefiles from scratch; I do something > like > > cp -r template.letter myletter > cd myletter > vim doc.ps > > and from that time on, F6 is all I have to type (except > for the document text, of course). > > Gunnar -------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 20-Aug-07 Time: 19:32:27 ------------------------------ XFMail ------------------------------