From 3105f13a7be56ea7b6e210b98742b4e1f9694e3f Mon Sep 17 00:00:00 2001 From: Simon Kaczor Date: Wed, 21 Aug 2013 09:29:40 -0400 Subject: [PATCH 1/8] Update CMakeLists.txt renamed files from ldg to ledger. Don't compile ledger-context.el because it has a macro. --- lisp/CMakeLists.txt | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/lisp/CMakeLists.txt b/lisp/CMakeLists.txt index 2258fd5d..33fe6f14 100644 --- a/lisp/CMakeLists.txt +++ b/lisp/CMakeLists.txt @@ -1,23 +1,21 @@ set(EMACS_LISP_SOURCES - ldg-commodities.el - ldg-complete.el - ldg-exec.el - ldg-fonts.el - ldg-init.el - ldg-mode.el - ldg-new.el - ldg-occur.el - ldg-post.el - ldg-reconcile.el - ldg-regex.el - ldg-report.el - ldg-sort.el - ldg-state.el - ldg-test.el - ldg-texi.el - ldg-xact.el - ldg-context.el - ldg-schedule.el) + ledger-commodities.el + ledger-complete.el + ledger-exec.el + ledger-fonts.el + ledger-init.el + ledger-mode.el + ledger-occur.el + ledger-post.el + ledger-reconcile.el + ledger-regex.el + ledger-report.el + ledger-schedule.el + ledger-sort.el + ledger-state.el + ledger-test.el + ledger-texi.el + ledger-xact.el) # find emacs and complain if not found find_program(EMACS_EXECUTABLE emacs) @@ -30,7 +28,7 @@ macro(add_emacs_lisp_target el) OUTPUT ${el}c COMMAND ${EMACS_EXECUTABLE} -L ${CMAKE_CURRENT_BINARY_DIR} - -l ${CMAKE_CURRENT_BINARY_DIR}/ldg-regex.el + -l ${CMAKE_CURRENT_BINARY_DIR}/ledger-regex.el -batch -f batch-byte-compile ${CMAKE_CURRENT_BINARY_DIR}/${el} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${el} From 30b6acb0b012fe0bb37ced1e15dc3315812960d3 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Sat, 7 Sep 2013 09:38:13 +0200 Subject: [PATCH 2/8] Apply --time-colon option only to time commodities See #989 --- src/amount.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/amount.cc b/src/amount.cc index 4fe73546..6ff2f4dd 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -196,8 +196,8 @@ namespace { for (const char * p = buf; *p; p++) { if (*p == '.') { - if (commodity_t::time_colon_by_default || - (comm && comm->has_flags(COMMODITY_STYLE_TIME_COLON))) + if (("h" == comm->symbol() || "m" == comm->symbol()) && (commodity_t::time_colon_by_default || + (comm && comm->has_flags(COMMODITY_STYLE_TIME_COLON)))) out << ':'; else if (commodity_t::decimal_comma_by_default || (comm && comm->has_flags(COMMODITY_STYLE_DECIMAL_COMMA))) @@ -213,8 +213,8 @@ namespace { out << *p; if (integer_digits > 3 && --integer_digits % 3 == 0) { - if (commodity_t::time_colon_by_default || - (comm && comm->has_flags(COMMODITY_STYLE_TIME_COLON))) + if (("h" == comm->symbol() || "m" == comm->symbol()) && (commodity_t::time_colon_by_default || + (comm && comm->has_flags(COMMODITY_STYLE_TIME_COLON)))) out << ':'; else if (commodity_t::decimal_comma_by_default || (comm && comm->has_flags(COMMODITY_STYLE_DECIMAL_COMMA))) @@ -744,7 +744,7 @@ void amount_t::in_place_unreduce() } if (shifted) { - if ("h" == comm->symbol() && commodity_t::time_colon_by_default) { + if (("h" == comm->symbol() || "m" == comm->symbol()) && commodity_t::time_colon_by_default) { amount_t floored = tmp.floored(); amount_t precision = tmp - floored; if (precision < 0.0) { From 816f4405b067751ff5081343e633a3ace131e6f0 Mon Sep 17 00:00:00 2001 From: Vinod Kurup Date: Sat, 7 Sep 2013 06:56:22 -0400 Subject: [PATCH 3/8] Move past the commodity sign --- lisp/ledger-xact.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ledger-xact.el b/lisp/ledger-xact.el index 25413e43..9629dca0 100644 --- a/lisp/ledger-xact.el +++ b/lisp/ledger-xact.el @@ -150,7 +150,8 @@ MOMENT is an encoded date" (backward-paragraph 2) (re-search-forward ledger-iso-date-regexp) (replace-match date) - (ledger-next-amount))) + (ledger-next-amount) + (forward-char 2))) (defun ledger-delete-current-transaction (pos) "Delete the transaction surrounging point." From 9a142ca65611142228e4ef2f488f3ceada5d7276 Mon Sep 17 00:00:00 2001 From: Craig Earls Date: Sat, 7 Sep 2013 10:17:46 -0700 Subject: [PATCH 4/8] Corrected discrepancies between documentation and drewr3.dat regarding apply and bucket --- doc/ledger3.texi | 2 +- test/input/drewr3.dat | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/doc/ledger3.texi b/doc/ledger3.texi index 0e22aad6..fbe08590 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -2000,7 +2000,7 @@ the account directive. For example: @smallexample apply account Personal 2011/11/15 Supermarket - Expenses:Groceries + Expenses:Groceries $ 50.00 Assets:Checking @end smallexample diff --git a/test/input/drewr3.dat b/test/input/drewr3.dat index e72ccd70..0e16466b 100644 --- a/test/input/drewr3.dat +++ b/test/input/drewr3.dat @@ -69,15 +69,4 @@ end tag Income:Sales end tag -apply account Expenses -bucket Assets:Checking -2011/04/25 Tom's Used Cars - Auto $ 5,500.00 - ; :nobudget: - -end account -apply payee Amazon.com B.*k Store - -2011/04/27 Book Store - Books $20.00 From 2bf852be94611a78dbe431371a4ec60d4d2c3c00 Mon Sep 17 00:00:00 2001 From: Wes Cravens Date: Sun, 8 Sep 2013 04:16:47 -0500 Subject: [PATCH 5/8] Remove reference to depricated ! operator in Chapt 4 --- doc/ledger3.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/ledger3.texi b/doc/ledger3.texi index fbe08590..83d0368f 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -1422,7 +1422,7 @@ increase compatibility with other text manipulation programs and methods four additional comment characters are valid if used at the beginning of a line: @samp{#}, @samp{|}, and @samp{*} and @samp{%}. -Block comments can be made by use @code{@!comment} ... @code{@!end +Block comments can be made by use @code{comment} ... @code{end comment}. @smallexample @@ -1432,10 +1432,10 @@ comment}. | and this, * and this. -!comment +comment This is a block comment with multiple lines -!end comment +end comment @end smallexample There are several forms of comments within a transaction, for example: From 7704018968e6783d526d6855a16ebac4a782438f Mon Sep 17 00:00:00 2001 From: Vinod Kurup Date: Sun, 8 Sep 2013 13:57:09 -0400 Subject: [PATCH 6/8] Find first numeral or minus sign, instead of blind move --- lisp/ledger-xact.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ledger-xact.el b/lisp/ledger-xact.el index 9629dca0..e6269580 100644 --- a/lisp/ledger-xact.el +++ b/lisp/ledger-xact.el @@ -151,7 +151,8 @@ MOMENT is an encoded date" (re-search-forward ledger-iso-date-regexp) (replace-match date) (ledger-next-amount) - (forward-char 2))) + (if (re-search-forward "[-0-9]") + (goto-char (match-beginning 0))))) (defun ledger-delete-current-transaction (pos) "Delete the transaction surrounging point." From 854adb4f3aa31b11717128594c012c252fedd03b Mon Sep 17 00:00:00 2001 From: Karl Fogel Date: Wed, 18 Sep 2013 16:51:04 -0500 Subject: [PATCH 7/8] Remove some obsolete material from the build instructions. It no longer works to create the "build" directory and then build separate optimized and debug versions. As confirmed in IRC with sm and egh, the former instructions resulted in an error: $ mkdir build $ ./acprep opt make make: *** No targets specified and no makefile found. Stop. acprep: ERROR: Execution failed: make $ ./acprep debug make make: *** No targets specified and no makefile found. Stop. acprep: ERROR: Execution failed: make Maybe there's a fix for this, but I don't know what it is, so this commit just makes the build instructions work for the common case. --- README-1ST | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/README-1ST b/README-1ST index 1a516353..21a50ea9 100644 --- a/README-1ST +++ b/README-1ST @@ -11,22 +11,10 @@ almost certainly going to run into problems. In future, you can run 'acprep update' again and again, and it will keep you updated to the very latest version. -I further recommend building both debug and optimized versions of Ledger, in a -subdirectory of your source tree named 'build' (which acprep will manage for -you, you simply need to create it): +Now install it: - $ mkdir build - $ ./acprep opt make - $ ./acprep debug make - -Now install the optimized version: - - $ cd build/ledger/opt $ sudo make install -but know that you have 'build/ledger/debug' available for testing and -for more useful bug reports. - =============================================================================== COMMON CONFIGURE/BUILD PROBLEMS =============================================================================== From d30c3fb869b8c4f7740eefec573fadedbe21b7d1 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 20 Sep 2013 00:54:21 -0500 Subject: [PATCH 8/8] Guard against a possible null value --- src/journal.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/journal.cc b/src/journal.cc index 3e2ecbea..7eeaabe8 100644 --- a/src/journal.cc +++ b/src/journal.cc @@ -151,7 +151,7 @@ account_t * journal_t::register_account(const string& name, post_t * post, // the payee indicates an account that should be used. if (result->name == _("Unknown")) { foreach (account_mapping_t& value, payees_for_unknown_accounts) { - if (value.first.match(post->xact->payee)) { + if (post && value.first.match(post->xact->payee)) { result = value.second; break; }