[Lazarus] Modifying the "File -> New Unit" template

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Apr 11 13:19:32 CEST 2017


On Tue, 11 Apr 2017 12:02:05 +0100
Graeme Geldenhuys via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

>[...]
> I want to change that so the default has difference uses clauses,
> defines the text encoding of the source file etc. Where does the above
> code come from? Hard-coded?

Yes, components/ideintf/projectintf.pas TFileDescPascalUnit
It creates the code from various IDE options and packages can define
their descendants to replace whole or parts. 

> eg:
>   MSEide has a ‘templates’ folder where all such auto-generated code is
>   defined. Nothing is hard-coded in the MSEide executable. From your
>   answer I assume Lazarus doesn’t do anything like this, and instead
>   hard-codes such default unit templates. :-/

It should be easy to add a "user unit" template, that loads the source
from a file and replaces some macros. 

Mattias


More information about the Lazarus mailing list