Johan's TFRC Help

From Gwen Morse's Wiki
Jump to: navigation, search
;;;Date: Wed, 21 Jan 1998 19:05:43 +0100
;;;From: Johan van Selst <johans at stack dot nl>
;;;Subject: tfrc help module
;;;Ok, this module is on a special request by Susan Dittmar; who set up
;;;that great site with collected TF macros ;-)
;;;I have quite a large .tfrc, and to keep track of all my functions and
;;;standard functions that I've redefined, I like to use my own help file.
;;;I used to do this with /myhelp that would consult TFRCHELP, a help file
;;;with the same structure as TFHELP (the standard TF helpfile).
;;;However, a redefinition of /help works much better: It calls the
;;;builtin /@help, using my own helpfile. And when this results in a
;;;message about no available help (ok, anything less than 61 chars);
;;;then it consults the default TFHELP file on this subject.
;;;Details about creating your own help file are are listed below.
;; The name of your own help file. The index file (~/.tfrc-help.idx)
;; must be available as well...

/set TFRCHELP ~/.tfrc-help

;; Use my help if it exists, fall back on builtin stuff otherwise
/def -i help = \
	/let tmphelp=%{TFHELP}%;\
	/let helplen=$[strlen($(/@help {*}))]%;\
	/if ({helplen} > 60) \
		/@help %{*}%;\
		/set TFHELP=%{tmphelp}%;\
	/else \
		/set TFHELP=%{tmphelp}%;\
		/@help %{*}%;\

;;;The setup of your own help file is quite easy. You can just look at the
;;;TFHELP file for a really great example: Use & for keywords at the top
;;;of the page and # to mark keywords of subparagraphs. New versions
;;;use (raw) ANSI colour codes as well... - which is a pain when editting
;;;with vim, but looks terrific in TF.
;;;Based on this helpfile, you can automatically generate a .idx file
;;;(%{TFRCHELP}.idx). A program to make these help-index files comes with
;;;with the standard distribution; called 'makehelp.c'. It reads from
;;;stdin and writes to stdout, so 'makehelp < tfrchelp > tfrchelp.idx'
;;;should do the trick.