Merge commit '45e74103607a77c5945615692c3a35f9ce6aadde' into next

This commit is contained in:
Craig Earls 2015-06-28 19:35:31 -07:00
commit 6e92d87d90
5 changed files with 28 additions and 14 deletions

View file

@ -225,7 +225,14 @@ macro(add_ledger_library_dependencies _target)
target_link_libraries(${_target} ${INTL_LIB}) target_link_libraries(${_target} ${INTL_LIB})
endif() endif()
if (HAVE_BOOST_PYTHON) if (HAVE_BOOST_PYTHON)
target_link_libraries(${_target} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) if(APPLE)
# Don't link directly to a Python framework on OS X, to avoid segfaults
# when the module is imported from a different interpreter
target_link_libraries(${_target} ${Boost_LIBRARIES})
set_target_properties(${_target} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
target_link_libraries(${_target} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
endif()
else() else()
target_link_libraries(${_target} ${Boost_LIBRARIES}) target_link_libraries(${_target} ${Boost_LIBRARIES})
endif() endif()

View file

@ -100,23 +100,15 @@ at beginning of account"
(let ((bounds (ledger-navigate-find-xact-extents pos))) (let ((bounds (ledger-navigate-find-xact-extents pos)))
(ledger-post-align-postings (car bounds) (cadr bounds)))) (ledger-post-align-postings (car bounds) (cadr bounds))))
(defun ledger-post-align-postings (&optional beg end) (defun ledger-post-align-postings (beg end)
"Align all accounts and amounts between BEG and END, or the current line." "Align all accounts and amounts between BEG and END, or the current region, or, if no region, the current line."
(interactive) (interactive "r")
(save-excursion (save-excursion
(if (or (not (mark))
(not (use-region-p)))
(set-mark (point)))
(let ((inhibit-modification-hooks t) (let ((inhibit-modification-hooks t)
(mark-first (< (mark) (point)))
acct-start-column acct-end-column acct-adjust amt-width amt-adjust acct-start-column acct-end-column acct-adjust amt-width amt-adjust
(lines-left 1)) (lines-left 1))
(unless beg (setq beg (if mark-first (mark) (point))))
(unless end (setq end (if mark-first (mark) (point))))
;; Extend region to whole lines ;; Extend region to whole lines
(let ((start-marker (set-marker (make-marker) (save-excursion (let ((start-marker (set-marker (make-marker) (save-excursion
(goto-char beg) (goto-char beg)

View file

@ -32,6 +32,7 @@
#include <system.hh> #include <system.hh>
#include "pyinterp.h" #include "pyinterp.h"
#include "pyutils.h"
#include "scope.h" #include "scope.h"
#include "mask.h" #include "mask.h"
#include "item.h" #include "item.h"
@ -64,6 +65,13 @@ namespace {
return item.get_tag(tag_mask, value_mask); return item.get_tag(tag_mask, value_mask);
} }
std::string py_position_pathname(position_t const& pos) {
return pos.pathname.native();
}
void py_position_set_pathname(position_t& pos, string const& s) {
pos.pathname = s;
}
} // unnamed namespace } // unnamed namespace
#if 0 #if 0
@ -79,8 +87,8 @@ void export_item()
{ {
class_< position_t > ("Position") class_< position_t > ("Position")
.add_property("pathname", .add_property("pathname",
make_getter(&position_t::pathname), make_function(py_position_pathname),
make_setter(&position_t::pathname)) make_function(py_position_set_pathname))
.add_property("beg_pos", .add_property("beg_pos",
make_getter(&position_t::beg_pos), make_getter(&position_t::beg_pos),
make_setter(&position_t::beg_pos)) make_setter(&position_t::beg_pos))
@ -169,6 +177,8 @@ void export_item()
.def("valid", &item_t::valid) .def("valid", &item_t::valid)
; ;
register_optional_to_python<position_t>();
} }
} // namespace ledger } // namespace ledger

View file

@ -1198,6 +1198,7 @@ option_t<report_t> * report_t::lookup_option(const char * p)
OPT_CH(collapse); OPT_CH(collapse);
else OPT(no_color); else OPT(no_color);
else OPT(no_pager); else OPT(no_pager);
else OPT(no_revalued);
else OPT(no_rounding); else OPT(no_rounding);
else OPT(no_titles); else OPT(no_titles);
else OPT(no_total); else OPT(no_total);

View file

@ -764,6 +764,10 @@ public:
OTHER(color).off(); OTHER(color).off();
}); });
OPTION_(report_t, no_revalued, DO() {
OTHER(revalued).off();
});
OPTION(report_t, no_rounding); OPTION(report_t, no_rounding);
OPTION(report_t, no_titles); OPTION(report_t, no_titles);
OPTION(report_t, no_total); OPTION(report_t, no_total);