From 9ecf0cbadb3de7129ed1c7aea2a32d404c0e8c2c Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Mon, 15 Dec 2014 18:43:15 +0000 Subject: [PATCH 1/3] Fix typo in docs --- doc/ledger3.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ledger3.texi b/doc/ledger3.texi index 05420295..22bab2af 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -5252,7 +5252,7 @@ Say you currently have this posting in your ledger file: Liabilities:MasterCard $-15.00 @end smallexample -Now it's @samp{2004/4/9}, and you've just eating at @samp{Viva Italiano} +Now it's @samp{2004/4/9}, and you've just eaten at @samp{Viva Italiano} again. The exact amounts are different, but the overall form is the same. With the @command{xact} command you can type: From 5717a03e3b23a98873e83b3f00b855cfb8201d3a Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Tue, 16 Dec 2014 08:41:53 +0000 Subject: [PATCH 2/3] [emacs] Make ledger-occur-mode auto-disable when restored by desktop.el The minor mode gets restored by desktop.el, and this has long caused errors. While the ideal would be to restore the mode along with the current narrowing regexp, this interim fix instead ensures that ledger-occur-mode will disable itself if it finds no regexp set. --- lisp/ledger-occur.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/ledger-occur.el b/lisp/ledger-occur.el index 0c1a07d7..4c2b0643 100644 --- a/lisp/ledger-occur.el +++ b/lisp/ledger-occur.el @@ -55,7 +55,7 @@ nil (:eval (format " Ledger-Narrow(%s)" ledger-occur-current-regex)) ledger-occur-mode-map - (if ledger-occur-mode + (if (and ledger-occur-current-regex ledger-occur-mode) (ledger-occur-refresh) (ledger-occur-remove-overlays) (message "Showing all transactions"))) From 0a0f2f0d69e694dd7dd3489bdfe6a3ad6281c230 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Tue, 16 Dec 2014 19:35:36 +0100 Subject: [PATCH 3/3] Fix crash when using -M with empty result ledger -f /dev/null reg -M test causes a segmentation fault, see bug 730 and duplicates 1080 and 1084 for details. Kudos to Ikke for helping with debugging. --- src/filters.cc | 2 +- test/regress/730.test | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 test/regress/730.test diff --git a/src/filters.cc b/src/filters.cc index bdc2983b..d24188f5 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -983,7 +983,7 @@ void interval_posts::flush() sort_posts_by_date()); // Determine the beginning interval by using the earliest post - if (all_posts.front() && + if (all_posts.size() > 0 && all_posts.front() && ! interval.find_period(all_posts.front()->date())) throw_(std::logic_error, _("Failed to find period for interval report")); diff --git a/test/regress/730.test b/test/regress/730.test new file mode 100644 index 00000000..d81a1c22 --- /dev/null +++ b/test/regress/730.test @@ -0,0 +1,37 @@ +; Using -M in combination with an empty result causes a segmentation fault +; therefore this test case does not have or need any test data + +test -f /dev/null -M reg +end test + +; Tests mentioned in #730 +test reg -M +end test + +test reg -M .foo +end test + +test reg -M -e 2012/01 +end test + + +; Tests mentioned in #1080 +test reg '^Expenses' and expr 'any(account =~ /^Assets:Cash/)' --period 'every week this month' +end test + +test bal '^Expenses' and expr 'any(account =~ /^Assets:Cash/)' --period 'every week this month' +end test + +test bal reg foo and expr 'any(account =~ /bar/)' --period 'every week' +end test + + +; Tests mentioned in #1084 +test b abc -M +end test + +test reg foo -M +end test + +test bal foo -M +end test