ledger-mode not formatting periodic transactions
hello, I'm new to Ledger and have a puzzling issue. When I input periodic transactions into my journal, ledger-mode won't format them correctly. However it handles normal transactions OK. It looks like this: 2019/12/25 automatic entry expenses 100 assets ~ monthly rent expenses 1000 assets ~ Monthly rent expenses 1000 assets 2019/12/25 manual entry expenses 100 assets Moving the point over the lines of the periodic transactions highlights each line, unlike highlighting the whole transaction as it should. My init.el is (use-package ledger-mode :config (setq ledger-binary-path "c:/users/george/bin/hledger/hledger.exe" ledger-mode-should-check-version nil) (add-to-list 'auto-mode-alist '("\.hledger\.journal" . ledger-mode)) (add-hook 'ledger-mode-hook (lambda () (setq-local tab-always-indent 'complete) (setq-local completion-cycle-threshold t) (setq-local ledger-complete-in-steps t))) ) This probably is something basic but I'm at a loss as to what. I'm using ledger-mode 4.0 with Emacs 26.2. Any ideas? thanks, George -- --- 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 ledger-cli+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/b32dcc32-af22-4983-883d-d953638e5818%40googlegroups.com.
Re: Periodic transactions aligned to started date
> "mg" == matt graham2001 writes: mg> I haven't got much experience in Cpp programming but interested in mg> learning. Can anyone give me a hint as to where to look to try to fix this mg> one myself? Would love to help out. I believe you can use the "ledger period " command to see what Ledger thinks the period is/means, and then check in the code where those debug messages are coming from to discover where the calculation is going wrong. John -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Periodic transactions aligned to started date
Hi All, I think this is bug #532 on github page https://github.com/ledger/ledger-plan/blob/master/TODO. Having said that, the bug isn't clear that the problem is that it resets the periodic entries to align to the 'start of period'. Ie Sunday for weekly or biweekly (unless you change the default first day of the week) or the first day of the month for monthly etc. For my use case, resetting the day of the week is not a solution - I am using multiple budget line items starting on multiple different days of the week. At the moment I have all the budget transactions listed out in a different account tree (Budget:Expenses:...), using automated transactions to replicate expense postings into the budget tree. Works well, but periodic transactions would be better - a lot easier on entry (I have written scripts to do it, but it gets messy). I haven't got much experience in Cpp programming but interested in learning. Can anyone give me a hint as to where to look to try to fix this one myself? Would love to help out. Thanks, Matt -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Periodic transactions aligned to started date
Hi Rob, Apologies for not replying earlier, got behind in my email again. On Sun, Jan 21, 2018 at 3:54 AM Rob Napier <robnap...@gmail.com> wrote: > On Friday, November 17, 2017 at 10:19:40 PM UTC-5, Scott Payne wrote: >> >> >> I'm still just playing with the periodic transactions for now so I'm not >> sure if I'm going to clash with the current implementation soon or not. >> Given the way I'm reviewing my budget your point about monthly transactions >> might be valid for me sooner rather than later (e.g. I might want to see >> which monthly expenses are due in the next fortnight) but we'll see how we >> go. >> > > How has this turned out? I've been very interested in the forecasting > feature to keep my forecast checking balance between a low- and high-water > mark, but the periodic implementation seems to fight this. All monthly > things seem to be put on the first of the month, and yearly expenses are > all but useless because I think they're all pushed to Jan 1. > I ended up giving up on periodic transactions, I couldn't make it work the way I needed to, for the same reason. What I've done instead is export to a CSV then import that into a Google Sheets template, with some app script to automate matching up accounts with budgeted amounts. Our household was already using Sheets for budgeting so it doing it that way fit our current workflow anyway. If you did get something working I'd be interested to hear what you did, it kind of sucks having to maintain two tools. Cheers, Scott -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Periodic transactions aligned to started date
On Friday, November 17, 2017 at 10:19:40 PM UTC-5, Scott Payne wrote: > > > I'm still just playing with the periodic transactions for now so I'm not > sure if I'm going to clash with the current implementation soon or not. > Given the way I'm reviewing my budget your point about monthly transactions > might be valid for me sooner rather than later (e.g. I might want to see > which monthly expenses are due in the next fortnight) but we'll see how we > go. > How has this turned out? I've been very interested in the forecasting feature to keep my forecast checking balance between a low- and high-water mark, but the periodic implementation seems to fight this. All monthly things seem to be put on the first of the month, and yearly expenses are all but useless because I think they're all pushed to Jan 1. Is there a way to day-by-day forecasting with ledger? What's the intent of the --forecast option? Thanks, -Rob -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Periodic transactions aligned to started date
On Friday, November 17, 2017 at 5:22:50 PM UTC+11, Yuri Khan wrote: > > On Fri, Nov 17, 2017 at 7:30 AM, Scott Payne <scott...@gmail.com > > wrote: > > > OK, I've just tried using the --start-of-week 4 instead of Thursday and > I > > get the result I expect > > That does not scale well. For one, do you have to remember to pass > this option every time you run ledger? For another, what if you need > two periodic transactions with different days? Also, it may work for > week days but obviously not for month days (--start-of-month 14?) > I agree with the points you've made Yuri, for now though the --start-of-week usage satisfies my use case. WRT remembering to pass the option I'm using direnv in my setup so I can set the LEDGER_START_OF_WEEK environment variable to keep it all automated. I'm still just playing with the periodic transactions for now so I'm not sure if I'm going to clash with the current implementation soon or not. Given the way I'm reviewing my budget your point about monthly transactions might be valid for me sooner rather than later (e.g. I might want to see which monthly expenses are due in the next fortnight) but we'll see how we go. -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Periodic transactions aligned to started date
On Saturday, November 18, 2017 at 4:12:40 AM UTC+11, John Wiegley wrote: > > > "SP" == Scott Paynewrites: > > SP> I can live with that. I tried using the day name as that was suggested > by > SP> the man page. Should I raise a documentation bug or is it a bug in the > SP> implementation? > > Looking at the code, I see this: > > optional string_to_day_of_week(const std::string& > str) > { > if (str == _("sun") || str == _("sunday") || str == "0") > return gregorian::Sunday; > else if (str == _("mon") || str == _("monday") || str == "1") > return gregorian::Monday; > else if (str == _("tue") || str == _("tuesday") || str == "2") > return gregorian::Tuesday; > else if (str == _("wed") || str == _("wednesday") || str == "3") > return gregorian::Wednesday; > else if (str == _("thu") || str == _("thursday") || str == "4") > return gregorian::Thursday; > else if (str == _("fri") || str == _("friday") || str == "5") > return gregorian::Friday; > else if (str == _("sat") || str == _("saturday") || str == "6") > return gregorian::Saturday; > else > return none; > } > > Try lowercase? > > John > D'oh, I should have tried that. Yes, that works. The man page I looked at does give the example "Mon" though which is probably what prompted me to try the capitalised day name. Thanks very much John. -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Periodic transactions aligned to started date
> "SP" == Scott Paynewrites: SP> I can live with that. I tried using the day name as that was suggested by SP> the man page. Should I raise a documentation bug or is it a bug in the SP> implementation? Looking at the code, I see this: optional string_to_day_of_week(const std::string& str) { if (str == _("sun") || str == _("sunday") || str == "0") return gregorian::Sunday; else if (str == _("mon") || str == _("monday") || str == "1") return gregorian::Monday; else if (str == _("tue") || str == _("tuesday") || str == "2") return gregorian::Tuesday; else if (str == _("wed") || str == _("wednesday") || str == "3") return gregorian::Wednesday; else if (str == _("thu") || str == _("thursday") || str == "4") return gregorian::Thursday; else if (str == _("fri") || str == _("friday") || str == "5") return gregorian::Friday; else if (str == _("sat") || str == _("saturday") || str == "6") return gregorian::Saturday; else return none; } Try lowercase? John -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Periodic transactions aligned to started date
On Fri, Nov 17, 2017 at 7:30 AM, Scott Payne <scottwpa...@gmail.com> wrote: > OK, I've just tried using the --start-of-week 4 instead of Thursday and I > get the result I expect That does not scale well. For one, do you have to remember to pass this option every time you run ledger? For another, what if you need two periodic transactions with different days? Also, it may work for week days but obviously not for month days (--start-of-month 14?) -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Periodic transactions aligned to started date
OK, I've just tried using the --start-of-week 4 instead of Thursday and I get the result I expect: $ ledger -f budget-test-weekly.ledger reg --budget --start-of-week 4 --no-color 2017-11-02 Budget transaction Expenses:Biweekly $-20 $-20 2017-11-02 Budget transaction Assets $20 0 2017-11-03 Some fortnightly thing Expenses:Biweekly $20$20 Assets $-20 0 2017-11-16 Budget transaction Expenses:Biweekly $-20 $-20 2017-11-16 Budget transaction Assets $20 0 2017-11-16 Corner case Expenses:Biweekly $20$20 Assets $-20 0 I can live with that. I tried using the day name as that was suggested by the man page. Should I raise a documentation bug or is it a bug in the implementation? -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Periodic transactions aligned to started date
On Friday, November 17, 2017 at 10:05:21 AM UTC+11, John Wiegley wrote: > > > "SP" == Scott Paynewrites: > > SP> I've tried "--start-of-week Thursday" but it has no effect. > > Does it have no effect in your report too, or just the period command? > > John > It doesn't seem to have an effect in either the period or register commands. Here's my test ledger file: ~ every 2 weeks from 2017/11/02 Expenses:Biweekly $20 Assets 2017-11-03 Some fortnightly thing Expenses:Biweekly $20 Assets:A Thing 2017-11-16 Corner case Expenses:Biweekly $20 Assets:Another thing Here's the output of running the register report: $ ledger -f budget-test.ledger reg --budget --start-of-week Thursday --no-color 2017-11-02 Budget transaction Expenses:Biweekly $-20 $-20 2017-11-02 Budget transaction Assets $20 0 2017-11-03 Some fortnightly thing Expenses:Biweekly $20$20 Assets $-20 0 2017-11-05 Budget transaction Expenses:Biweekly $-20 $-20 2017-11-05 Budget transaction Assets $20 0 2017-11-16 Corner case Expenses:Biweekly $20$20 Assets $-20 0 Ledger version is 3.1.1-20160111 FWIW. -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Periodic transactions aligned to started date
> "SP" == Scott Paynewrites: SP> I've tried "--start-of-week Thursday" but it has no effect. Does it have no effect in your report too, or just the period command? John -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Periodic transactions aligned to started date
I've been doing some budgeting and want to sit down once a fortnight to review whether I'm on track or not. So I have budgeted some expenses on a fortnightly basis but there are some things that have to come out monthly and there are even some every six weeks. I do my budget on a Thursday night so I'd really like to have my fortnightly budgets start on Thursday. I've been trying to use periodic transactions in ledger and it's not working the way I would like. I want to say e.g. "every 2 weeks from 2017-11-02" and have the budget period go from 2 Nov to 15 Nov, then 16 Nov to 29 Nov etc. But the behaviour I'm seeing in ledger is the period goes from the 2nd to the 4th, and then starts two weeks from the 5th. $ ledger period 'every 2 weeks from 2017-11-02' --- Period expression tokens --- TOK_EVERY: every TOK_INT: 2 TOK_WEEKS: weeks TOK_SINCE: since TOK_DATE: year 2017 month Nov day 2 END_REACHED: --- Before stabilization --- range: from year 2017 month Nov day 2 duration: 2 weeks --- After stabilization --- range: from year 2017 month Nov day 2 start: 17-Nov-02 duration: 2 weeks --- Sample dates in range (max. 20) --- 1: 17-Nov-02 -- 17-Nov-04 2: 17-Nov-05 -- 17-Nov-18 3: 17-Nov-19 -- 17-Dec-02 4: 17-Dec-03 -- 17-Dec-16 5: 17-Dec-17 -- 17-Dec-30 6: 17-Dec-31 -- 18-Jan-13 7: 18-Jan-14 -- 18-Jan-27 8: 18-Jan-28 -- 18-Feb-10 9: 18-Feb-11 -- 18-Feb-24 10: 18-Feb-25 -- 18-Mar-10 11: 18-Mar-11 -- 18-Mar-24 12: 18-Mar-25 -- 18-Apr-07 13: 18-Apr-08 -- 18-Apr-21 14: 18-Apr-22 -- 18-May-05 15: 18-May-06 -- 18-May-19 16: 18-May-20 -- 18-Jun-02 17: 18-Jun-03 -- 18-Jun-16 18: 18-Jun-17 -- 18-Jun-30 19: 18-Jul-01 -- 18-Jul-14 20: 18-Jul-15 -- 18-Jul-28 I've tried "--start-of-week Thursday" but it has no effect. Is it possible to achieve what I want to achieve using ledger's periodic transactions, or do I need to go another way? -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Setting periodic transactions with beginning/end dates?
A follow-up question. Is there a way to have the period retain the offset established by the start date? E.g. weekly every wednesday, yearly every Oct 1st, etc.? Output from the period command seems to suggest that the offset is reset after the first (shortened) period: (I'm currently on Ledger 3.0.1-20140327): $ ledger period yearly from 2013/10/01 --- Period expression tokens --- TOK_YEARLY: yearly TOK_SINCE: since TOK_DATE: year 2013 month Oct day 1 END_REACHED: EOF --- Before stabilization --- range: from year 2013 month Oct day 1 duration: 1 year --- After stabilization --- range: from year 2013 month Oct day 1 start: 13-Oct-01 duration: 1 year --- Sample dates in range (max. 20) --- 1: 13-Oct-01 -- 13-Dec-31 2: 14-Jan-01 -- 14-Dec-31 3: 15-Jan-01 -- 15-Dec-31 4: 16-Jan-01 -- 16-Dec-31 5: 17-Jan-01 -- 17-Dec-31 6: 18-Jan-01 -- 18-Dec-31 7: 19-Jan-01 -- 19-Dec-31 8: 20-Jan-01 -- 20-Dec-31 9: 21-Jan-01 -- 21-Dec-31 10: 22-Jan-01 -- 22-Dec-31 11: 23-Jan-01 -- 23-Dec-31 12: 24-Jan-01 -- 24-Dec-31 13: 25-Jan-01 -- 25-Dec-31 14: 26-Jan-01 -- 26-Dec-31 15: 27-Jan-01 -- 27-Dec-31 16: 28-Jan-01 -- 28-Dec-31 17: 29-Jan-01 -- 29-Dec-31 18: 30-Jan-01 -- 30-Dec-31 19: 31-Jan-01 -- 31-Dec-31 20: 32-Jan-01 -- 32-Dec-31 On Saturday, October 11, 2014 at 4:17:06 AM UTC-7, Paul Rankin wrote: John Wiegley jo...@newartisans.com javascript: writes: You can say Weekly until DATE, for example. Anything that would work in a reporting period, will work in a periodic transaction specifier. They use the same mechanism. John Thanks you, much appreciated John! -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Setting periodic transactions with beginning/end dates?
John Wiegley jo...@newartisans.com writes: You can say Weekly until DATE, for example. Anything that would work in a reporting period, will work in a periodic transaction specifier. They use the same mechanism. John Thanks you, much appreciated John! -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Setting periodic transactions with beginning/end dates?
Paul Rankin p...@tilk.co writes: Is there a way to set period transactions to have beginning or end dates? You can say Weekly until DATE, for example. Anything that would work in a reporting period, will work in a periodic transaction specifier. They use the same mechanism. John -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Setting periodic transactions with beginning/end dates?
Is there a way to set period transactions to have beginning or end dates? e.g. say I have a projected weekly income of $100.00 from Foo only until a specific date, and conversely a projected weekly income from Bar of $110.00 but only from a specific date onwards, which I would think of as something akin to: ~ Weekly Income:Foo $-100.00 ; [2014-09-10] Income:Bar $-110.00 ; [=2014-09-10] Assets Any ideas? -- --- 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 ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.