# etfinsrt(3)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

etfinsrt - Insert template file into current buffer

## SYNOPSIS

etfinsrt "template"

## DESCRIPTION

etfinsrt is generally called by file hooks when the new buffer has been created as opposed to loaded from a file (see $buffer-fhook(5)).

etfinsrt uses &find(4) to locate and insert the required "template.etf" file. If successful, etfinsrt then replaces the following strings in the template:

`$ASCII_TIME$`

To the current time. Inserts the output of ascii-time(3). The default format of the time string may be changed with .ascii-time.format(5).

`$BUFFER_NAME$`

To the buffer name. The name is capitalized, '.'s are replaced with '_' and any trailing "<##>" digits (used to make the buffer name unique) are removed.

`$COMPANY_NAME$`

To the value of %company-name, or if not defined to the value used for `$USER_NAME$`. %company-name is usually set up in the company setup file defined in User setup.

`$USER_NAME$`

To the value of the registry entry "`/history/user-name`", or if not defined to the value "`<unknown>`". The user name is usually set up in the User setup dialog.

`$YEAR$`

To the current year (4 digit number).

`$CURSOR$`

To leave the cursor at this point, only one of these tokens should be used in the template and the token is removed.

## EXAMPLE

The following is taken from hkmake.emf and inserts the "makefile.etf" template if the buffer has been created.

    define-macro fhook-make
        ; if arg is 0 this is a new file so add template
        !if &not @#
            etfinsrt "makefile"
        !endif
        set-variable $buffer-hilight .hilight.make
        -1 buffer-mode "tab"		; Normal tabs please !!!
        1 buffer-mode "indent"
        1 buffer-mode "time"
    !emacro

## NOTES

etfinsrt is a macro defined in `etfinsrt.emf`.

magic(2m) mode is always used to perform the the search/replace so the replace strings should be appropriate for magic.

## SEE ALSO

.ascii-time.format(5), $buffer-fhook(5), &find(4), ascii-time(3).

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>