From 172591b8cf8f1893dd387155259e982cdddc893d Mon Sep 17 00:00:00 2001 From: Dan White Date: Thu, 3 Nov 2011 18:51:56 -0500 Subject: [PATCH 1/2] Use backwards-compatible GMP_RNDx symbols. mpfr-2.4 uses GMP_RNDx while mpfr-3.0 uses MPFR_RNDx. Fortunately, mpfr-3.0 also has a set of backwards-compatible defines: #define GMP_RNDx MPFR_RNDx This allows using the GMP_ form and work for both 2.4 and 3.0. --- src/amount.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/amount.cc b/src/amount.cc index 99e346b7..8f187515 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -115,7 +115,7 @@ namespace { mpq_t quant, amount_t::precision_t precision, int zeros_prec = -1, - mpfr_rnd_t rnd = MPFR_RNDN, + mpfr_rnd_t rnd = GMP_RNDN, const optional& comm = none) { char * buf = NULL; @@ -670,7 +670,7 @@ void amount_t::in_place_floor() _dup(); std::ostringstream out; - stream_out_mpq(out, MP(quantity), precision_t(0), -1, MPFR_RNDZ); + stream_out_mpq(out, MP(quantity), precision_t(0), -1, GMP_RNDZ); mpq_set_str(MP(quantity), out.str().c_str(), 10); } @@ -845,8 +845,8 @@ double amount_t::to_double() const if (! quantity) throw_(amount_error, _("Cannot convert an uninitialized amount to a double")); - mpfr_set_q(tempf, MP(quantity), MPFR_RNDN); - return mpfr_get_d(tempf, MPFR_RNDN); + mpfr_set_q(tempf, MP(quantity), GMP_RNDN); + return mpfr_get_d(tempf, GMP_RNDN); } long amount_t::to_long() const @@ -854,14 +854,14 @@ long amount_t::to_long() const if (! quantity) throw_(amount_error, _("Cannot convert an uninitialized amount to a long")); - mpfr_set_q(tempf, MP(quantity), MPFR_RNDN); - return mpfr_get_si(tempf, MPFR_RNDN); + mpfr_set_q(tempf, MP(quantity), GMP_RNDN); + return mpfr_get_si(tempf, GMP_RNDN); } bool amount_t::fits_in_long() const { - mpfr_set_q(tempf, MP(quantity), MPFR_RNDN); - return mpfr_fits_slong_p(tempf, MPFR_RNDN); + mpfr_set_q(tempf, MP(quantity), GMP_RNDN); + return mpfr_fits_slong_p(tempf, GMP_RNDN); } commodity_t& amount_t::commodity() const @@ -1240,7 +1240,7 @@ void amount_t::print(std::ostream& _out, const uint_least8_t flags) const } stream_out_mpq(out, MP(quantity), display_precision(), - comm ? commodity().precision() : 0, MPFR_RNDN, comm); + comm ? commodity().precision() : 0, GMP_RNDN, comm); if (comm.has_flags(COMMODITY_STYLE_SUFFIXED)) { if (comm.has_flags(COMMODITY_STYLE_SEPARATED)) From ef5283d7f2dbc1a9fa7228e9877bcf1fca547ef0 Mon Sep 17 00:00:00 2001 From: Kenny Meyer Date: Fri, 9 Dec 2011 00:56:14 -0200 Subject: [PATCH 2/2] Add easy-menu for Emacs-mode --- lisp/ledger.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lisp/ledger.el b/lisp/ledger.el index 2d15f090..56bc33cd 100644 --- a/lisp/ledger.el +++ b/lisp/ledger.el @@ -1316,6 +1316,24 @@ end of a ledger file which is included in some other file." (expand-file-name ledger-master-file) (buffer-file-name))) +(easy-menu-define ledger-menu ledger-mode-map + "Ledger menu" + '("Ledger" + ["New entry" ledger-add-entry t] + ["Toggle cleared status of current entry" ledger-toggle-current-entry t] + ["Set default year for entry" ledger-set-year t] + ["Set default month for entry" ledger-set-month t] + "--" + ["Reconcile uncleared entries for account" ledger-reconcile t] + "--" + "Reports" + ["Run a report" ledger-report t] + ["Go to report buffer" ledger-report-goto t] + ["Edit defined reports" ledger-report-edit t] + ["Save report definition" ledger-report-save t] + ["Re-run ledger report" ledger-report-redo t] + ["Kill report buffer" ledger-report-kill t])) + (provide 'ledger) ;;; ledger.el ends here