groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Groff editor.


From: Gunnar Ritter
Subject: Re: [Groff] Groff editor.
Date: Mon, 20 Aug 2007 19:58:24 +0200
User-agent: Heirloom mailx 12.4pre 8/4/07

(Ted Harding) <address@hidden> 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?

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]