summaryrefslogtreecommitdiff
path: root/lisp/ledger-post.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2015-11-04 19:19:07 -0700
committerCraig Earls <enderw88@gmail.com>2015-11-04 19:19:07 -0700
commitcb05126e18f4d2fa5aa18cdb5a6af03436962068 (patch)
tree2691f85ddd6c90c986a821bc646f5d0f582a7217 /lisp/ledger-post.el
parent1cf83c6f5f5d005fb143f34b32b86bb838cd9674 (diff)
parentd38f8d3bff66e89cc79b1791566fdf9eca62a8e9 (diff)
downloadfork-ledger-cb05126e18f4d2fa5aa18cdb5a6af03436962068.tar.gz
fork-ledger-cb05126e18f4d2fa5aa18cdb5a6af03436962068.tar.bz2
fork-ledger-cb05126e18f4d2fa5aa18cdb5a6af03436962068.zip
Merge commit 'd38f8d3bff66e89cc79b1791566fdf9eca62a8e9' into next
Diffstat (limited to 'lisp/ledger-post.el')
-rw-r--r--lisp/ledger-post.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/ledger-post.el b/lisp/ledger-post.el
index d741442a..f4727342 100644
--- a/lisp/ledger-post.el
+++ b/lisp/ledger-post.el
@@ -41,6 +41,16 @@
:type 'integer
:group 'ledger-post)
+(defcustom ledger-post-amount-alignment-at :end
+ "Position at which the amount is ailgned.
+
+Can be :end to align on the last number of the amount (can be
+followed by unaligned commodity) or :decimal to align at the
+decimal separator."
+ :type '(radio (const :tag "align at the end of amount" :end)
+ (const :tag "align at the decimal separator" :decimal))
+ :group 'ledger-post)
+
(defcustom ledger-post-use-completion-engine :built-in
"Which completion engine to use, :iswitchb or :ido chose those engines.
:built-in uses built-in Ledger-mode completion"
@@ -79,7 +89,11 @@ point at beginning of the commodity."
(when (re-search-forward ledger-amount-regex end t)
(goto-char (match-beginning 0))
(skip-syntax-forward " ")
- (- (match-end 3) (point)))))
+ (cond
+ ((eq ledger-post-amount-alignment-at :end)
+ (- (or (match-end 4) (match-end 3)) (point)))
+ ((eq ledger-post-amount-alignment-at :decimal)
+ (- (match-end 3) (point)))))))
(defun ledger-next-account (&optional end)
"Move to the beginning of the posting, or status marker, limit to END.