**SOLVED**:  Ansify the additional newline so that it is not 
stripped/disregarded by the ledger executable.

    (let ((register-format (concat "\"%(!cleared"
                                      " ? ansify_if (date, bold)"
                                      " : ansify_if (date, blue if color))"
                                   "  %(ansify_if (justify (truncated 
(display_account, int(account_width), int(abbrev_len)), 
int(account_width)),"
                                                  " white if color))"
                                   " %((display_amount < 0)"
                                      " ? (!cleared"
                                          " ? ansify_if (justify (scrub 
(display_amount), 13, -1, true, color), bold)"
                                          " : justify (scrub 
(display_amount), 13, -1, true, color))"
                                      " : ansify_if (justify (scrub 
(display_amount), 13, -1, true, color), black if color))"
                                   " %((display_total < 0)"
                                      " ? justify (scrub (display_total), 
13, -1, true, color)"
                                      " : ansify_if (justify (scrub 
(display_total), 13, -1, true, color), black if color))"
                                   "  %(cleared"
                                       " ? ansify_if (\\\"*\\\", yellow if 
color)"
                                       " : (pending"
                                           " ? ansify_if (\\\"!\\\", 
magenta if color)"
                                           " : \\\" \\\"))"
                                   "  %(ansify_if (payee, blink if color 
and !cleared and actual))"
                                   "%(ansify_if (\\\"\\n\\\", bold))\n"
                                   "%/\"")))
      [INSERT COMMAND LINE ARGS HERE])

On Saturday, January 9, 2021 at 4:44:00 PM UTC-8 Keith David Bershatsky 
wrote:

> Is there a way to double-space the output of reports (e.g., a register 
> report) so that there is a blank line between each entry?
>
> What appears to be happening is that ledger has a built-in replace-regexp 
> that removes any extra `\n` beyond just one at the end of the report 
> format.  Through trial and error, I have found two workarounds, neither of 
> them being absolutely perfect.
>
> #1 workaround:  Place a `\n` at the beginning of the format string and 
> another `\n` at the end of the format string.
>
> #2 workaround:  Place a `\n` form-feed `\n` at the end of the format 
> string.
>
> With workaround #1, there is an extra blank line at the beginning of the 
> report.
>
> With workaround #2, each line without an entry has a form-feed character.
>
> Sure, I can use Emacs to fix anything after the report has been generated, 
> either by modifying the report string before it is inserted into the buffer 
> or modifying the buffer after the report string has been inserted.  I could 
> also use Emacs to change the form-feed character into anything else using 
> the buffer-display-table to modify that entry.  I could use another ascii 
> character instead of form-feed, such as a zero-width-space (although I 
> haven't tried that).  After a few days, I might even start to like seeing 
> the form-feed character -- who knows...
>
> All of that being said, is there any way to just use `\n\n` or another 
> setting that accomplishes the same thing?
>
> Here is my report format.  I need to use a custom register format because 
> the ledger executable has a bug that cannot deal with very long payee lines 
> when using the built-in register-format where mandatory truncation fails 
> and the report stops being generated at the segfault something 1024.  At 
> some point, I'll file a formal bug report.  I'm actually quite happy using 
> my own report format ... I just need some double-spacing for readability ...
>
>     (let ((register-format (concat "\"%(!cleared"
>                                 " ? ansify_if (date, bold)"
>                                 " : ansify_if (date, blue if color))"
>                              "  %(ansify_if (justify (truncated 
> (display_account, int(account_width), int(abbrev_len)), 
> int(account_width)),"
>                                             " white if color))"
>                              " %((display_amount < 0)"
>                                 " ? (!cleared"
>                                     " ? ansify_if (justify (scrub 
> (display_amount), 13, -1, true, color), bold)"
>                                     " : justify (scrub (display_amount), 
> 13, -1, true, color))"
>                                 " : ansify_if (justify (scrub 
> (display_amount), 13, -1, true, color), black if color))"
>                              " %((display_total < 0)"
>                                 " ? justify (scrub (display_total), 13, 
> -1, true, color)"
>                                 " : ansify_if (justify (scrub 
> (display_total), 13, -1, true, color), black if color))"
>                              "  %(cleared"
>                                  " ? ansify_if (\\\"*\\\", yellow if 
> color)"
>                                  " : (pending"
>                                      " ? ansify_if (\\\"!\\\", magenta if 
> color)"
>                                      " : \\\" \\\"))"
>                              "  %(ansify_if (payee, blink if color and 
> !cleared and actual))\n \n\"")))
>       ...)
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/8d1ca2f4-5a65-4dbe-81e7-f18bcff2c386n%40googlegroups.com.

Reply via email to