summaryrefslogtreecommitdiff
path: root/lisp/ldg-post.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ldg-post.el')
-rw-r--r--lisp/ldg-post.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/ldg-post.el b/lisp/ldg-post.el
index 2d7a0e05..492f9467 100644
--- a/lisp/ldg-post.el
+++ b/lisp/ldg-post.el
@@ -83,6 +83,13 @@ to choose from."
(delete-char 1)))))))
(goto-char pos)))
+(defun ledger-next-amount (&optional end)
+ (when (re-search-forward "\\( \\|\t\\| \t\\)[ \t]*-?\\([A-Z$]+ *\\)?\\(-?[0-9,]+?\\)\\(.[0-9]+\\)?\\( *[A-Z$]+\\)?\\([ \t]*@@?[^\n;]+?\\)?\\([ \t]+;.+?\\)?$" (marker-position end) t)
+ (goto-char (match-beginning 0))
+ (skip-syntax-forward " ")
+ (- (or (match-end 4)
+ (match-end 3)) (point))))
+
(defun ledger-align-amounts (&optional column)
"Align amounts in the current region.
This is done so that the last digit falls in COLUMN, which defaults to 52."
@@ -164,6 +171,4 @@ This is done so that the last digit falls in COLUMN, which defaults to 52."
(add-hook 'after-change-functions 'ledger-post-maybe-align t t))
(add-hook 'after-save-hook #'(lambda () (setq ledger-post-current-list nil))))
-(add-hook 'ledger-mode-hook 'ledger-post-setup)
-
(provide 'ldg-post)