summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2015-06-28 19:35:31 -0700
committerCraig Earls <enderw88@gmail.com>2015-06-28 19:35:31 -0700
commit6e92d87d907cb3663f9c463da215f21c7e30bc39 (patch)
tree138ae6d97c0a53d6f8174aae985c4b0fd92a83d5
parent5f03a94b522f4c348ae952e2dfdba98e71a35b8f (diff)
parent45e74103607a77c5945615692c3a35f9ce6aadde (diff)
downloadfork-ledger-6e92d87d907cb3663f9c463da215f21c7e30bc39.tar.gz
fork-ledger-6e92d87d907cb3663f9c463da215f21c7e30bc39.tar.bz2
fork-ledger-6e92d87d907cb3663f9c463da215f21c7e30bc39.zip
Merge commit '45e74103607a77c5945615692c3a35f9ce6aadde' into next
-rw-r--r--CMakeLists.txt9
-rw-r--r--lisp/ledger-post.el14
-rw-r--r--src/py_item.cc14
-rw-r--r--src/report.cc1
-rw-r--r--src/report.h4
5 files changed, 28 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index da075cde..6166780c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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()
diff --git a/lisp/ledger-post.el b/lisp/ledger-post.el
index 527a2044..21e856db 100644
--- a/lisp/ledger-post.el
+++ b/lisp/ledger-post.el
@@ -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)
diff --git a/src/py_item.cc b/src/py_item.cc
index 473bbef8..4dd104c9 100644
--- a/src/py_item.cc
+++ b/src/py_item.cc
@@ -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
diff --git a/src/report.cc b/src/report.cc
index 2ce70151..ac08c247 100644
--- a/src/report.cc
+++ b/src/report.cc
@@ -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);
diff --git a/src/report.h b/src/report.h
index c54c8444..10afbe6f 100644
--- a/src/report.h
+++ b/src/report.h
@@ -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);