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})
endif()
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()
target_link_libraries(${_target} ${Boost_LIBRARIES})
endif()

View file

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

View file

@ -32,6 +32,7 @@
#include <system.hh>
#include "pyinterp.h"
#include "pyutils.h"
#include "scope.h"
#include "mask.h"
#include "item.h"
@ -64,6 +65,13 @@ namespace {
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
#if 0
@ -79,8 +87,8 @@ void export_item()
{
class_< position_t > ("Position")
.add_property("pathname",
make_getter(&position_t::pathname),
make_setter(&position_t::pathname))
make_function(py_position_pathname),
make_function(py_position_set_pathname))
.add_property("beg_pos",
make_getter(&position_t::beg_pos),
make_setter(&position_t::beg_pos))
@ -169,6 +177,8 @@ void export_item()
.def("valid", &item_t::valid)
;
register_optional_to_python<position_t>();
}
} // namespace ledger

View file

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

View file

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