[GNC-dev] [GNC] Dipping my toes into Scheme

Christopher Lam christopher.lck at gmail.com
Mon Mar 23 21:20:00 EDT 2020


This may indicate a Mac .app issue -- maybe it doesn't like being modified.
For that matter it may be much safer to play on a Linux VM and downloading
the sources instead.
Alternatively try the config-user.scm method on
https://wiki.gnucash.org/wiki/Custom_Reports

On Mon, 23 Mar 2020 at 22:13, Michael Hendry <hendry.michael at gmail.com>
wrote:

> > On 23 Mar 2020, at 12:48, Christopher Lam <christopher.lck at gmail.com>
> wrote:
> >
> > This is more suitable for devel.
> >
> > On Mon, 23 Mar 2020 at 11:29, Michael Hendry <hendry.michael at gmail.com>
> wrote:
> > Rather than dive into Scheme programming with a completely new report,
> I’d like to try editing an existing report to provide a little
> customisation.
> > I’m looking at the experimental report balsheet-pnl.scm by Christopher
> Lam, which I found here on my Mac…
> >
> > Not the easiest report to start with.
> >
> > In other programming environments I would simply save the edited file
> and run it, but I can see a few pitfalls!
> > Line 28 reads:
> > (define-module (gnucash report standard-reports balsheet-pnl))
> > which should presumably be changed, e.g. to:
> > (define-module (gnucash report standard-reports MH_balsheet-pnl))
> >
> > Correct. The define-module name must match the file path; this is a
> requirement in the standard-reports folder. Can't remember where exactly
> this is enforced.
> >
> > After that, I think it should be plain sailing until line 1340:
> > (define balsheet-reportname (_ "Balance Sheet (Multicolumn)"))
> > (define pnl-reportname (_ "Income Statement (Multicolumn)"))
> >
> > (gnc:define-report
> >  'version 1
> >  'name balsheet-reportname
> >  'report-guid "065d5d5a77ba11e8b31e83ada73c5eea"
> >  'menu-path (list gnc:menuname-experimental)
> >  'options-generator (lambda () (multicol-report-options-generator
> 'balsheet))
> >  'renderer (lambda (rpt) (multicol-report-renderer rpt 'balsheet)))
> >
> > (gnc:define-report
> >  'version 1
> >  'name pnl-reportname
> >  'report-guid "0e94fd0277ba11e8825d43e27232c9d4"
> >  'menu-path (list gnc:menuname-experimental)
> >  'options-generator (lambda () (multicol-report-options-generator 'pnl))
> >  'renderer (lambda (rpt) (multicol-report-renderer rpt 'pnl)))
> >
> > I expect there would be scope for confusion if I didn’t change lines
> 1340-1 - say prefixing “MH_” to the definitions, but I’m not sure about the
> options-generator and renderer lines.
> >
> > No. these lines define the options-generator to be a procedure with no
> arguments i.e. lambda () that calls (multicol-report-options-generator
> 'pnl). The 'pnl is used to direct the multicol-report-options-generator to
> provide options suitable for profit-n-loss aka 'pnl. See the definition of
> multicol-report-options-generator and locate where 'pnl is tested.
> >
> > uuidgen on my Mac issues 36-character uuids, with hyphens and uppercase,
> like this:
> > 47170C69-F87E-4A3B-9A97-8B97F56F5DFD
> > Would I need to edit them to give 32-character lowercase uuids, lacking
> hyphens?
> >
> > Actually any unique string of any length will do.
> >
> > Obviously, I have to take responsibility for my own programming
> experiments (and errors), but I’d appreciate a quick steer from someone
> with Scheme experience. Regards,
> > Michael
> >
> > Good luck!
>
> Thanks for your prompt response, Christopher.
>
> I was naive enough to think that all I had to do was create a duplicate
> report file in the same directory as above, rename it, then run GnuCash and
> see what happened.
>
> Unfortunately (i.e. predictably) what happened was the GC splash screen
> came up for a few seconds, then disappeared without bringing up the Gnucash
> UI.
>
> Running from the command line brought up an error message about
> compilation, but running with compilation switched off didn’t help.
>
> I’ve since deleted the new file, but still can’t get Gnucash to run - not
> even a newly downloaded and installed copy of version 3.8.
>
> I’ve clearly broken something fundamental, but having spent much of today
> searching for the damage, I’ve failed.
>
> I’d really appreciate a steer in the right direction, but I think I may
> have to uninstall GnuCash and start again.
>
> Michael
>
>
>


More information about the gnucash-devel mailing list