Code cleanup
Merge branch 'master' into ledger-mode-bug-1063-auto-refresh-reports
ledger-redo added as after-save-hook
Improve report redo logic.
Added ledger-report-auto-refresh customization variable.
make leder-mode-dump-configuration interactive
Make the reconcile balance status message more clear.
Preserve original cost basis when gain or loss is made

Change the definition of cost: in the past, if you bought 1 AAA for
$10 and then sold it for $12, ledger would take $12 as the cost.  With
the patch, the original cost of $10 is preserved ss the cost basis.
In my opinion, this brings ledger in line with accounting expectations.

This change fixes bugs #712 and #713.

Bug #712 is about Equity:Capital Gains and Equity:Capital Loss
entries ledger automatically generates that are in my opinion
incorrect.

Bug #713 is about strange behaviour with -B after a capital gain or
loss is made.

Patch from John Wiegley.
Update tests for fix for bug #713

John's fix for bug #713 changes the way basis cost are calculated.
The patch also fixes #712, which caused ledger to create automatic
Equity:Capital Gains that were not correct.  Update the test cases
accordingly after verifying the new output.
Regenerate tests for fix for bug #713

The fix for bug #713 changes the way capital gains as well as basis costs
are shown.  All of these tests use the same input file, which includes
capital gains and losses.  The tests are too long to update and verify
manually but I verified some files and believe the output is correct.
I've therefore updated the tests with the output of the fixed ledger.

Let's take baseline/opt-lot-dates.test as one example.  In the past,
ledger generated the following incorrect Equity entries:

             190.42G  Equity
             236.83G    Capital Gains
             -46.41G    Capital Losses

If you compare the end of the diff of the test, you'll see:

  -                                                  35.42G
  +                                                -155.00G

The difference is: 35.42 - -155.00 = 190.42

This matches exactly the Equity entries previously generated, which
shouldn't be there.
Add regression tests for bug #713
Add a regression test for bug #712
Preserve the given cost for print

Patch from John Wiegley
Merge pull request #310 from tbm/712-713-costs

Change the definition of cost
tracking in_place_round
removing unused debug statements
debug values
For ledger-post-align-postings to run on xacts added with ledger-add
debug value.cc
debug add to value