when and when not to use define-module

Geert Janssens janssens-geert at telenet.be
Fri Nov 2 12:07:15 EDT 2012


On 02-11-12 16:35, Derek Atkins wrote:
> Hi,
>
> "mcmurchy1917-gnucash at yahoo.co.uk" <mcmurchy1917-gnucash at yahoo.co.uk>
> writes:
>
>> Why is it that that a custom report needs this definition
>>
>> (define-module (gnucash report a-module))
>>
>> when installed as a 'proper' report in /usr/share/gnucash/guile-modules/gnucash/report
>>
>> but needs to be commented out when installed in the users .gnucash directory
> It's due to the method that the code is loaded.  GnuCash loads the files
> in the 'reports' section as modules so it expects to be declared as
> one.  Whereas when you "load-file" directly it is not expecting a module
> and bombs out if you find one.
>
That's why the wiki page on custom reports tells you to use 'load' 
instead of 'load-from-path' to load custom reports. This has been so at 
least since 2.4. 'load-from-path' is deprecated for custom reports.

Geert


More information about the gnucash-user mailing list