Merge pull request #434 from Fuco1/align-on-decimal
Align amounts on the decimal separator. Thank you.
This commit is contained in:
commit
64426842a3
2 changed files with 9 additions and 4 deletions
|
|
@ -79,8 +79,7 @@ point at beginning of the commodity."
|
||||||
(when (re-search-forward ledger-amount-regex end t)
|
(when (re-search-forward ledger-amount-regex end t)
|
||||||
(goto-char (match-beginning 0))
|
(goto-char (match-beginning 0))
|
||||||
(skip-syntax-forward " ")
|
(skip-syntax-forward " ")
|
||||||
(- (or (match-end 4)
|
(- (match-end 3) (point)))))
|
||||||
(match-end 3)) (point)))))
|
|
||||||
|
|
||||||
(defun ledger-next-account (&optional end)
|
(defun ledger-next-account (&optional end)
|
||||||
"Move to the beginning of the posting, or status marker, limit to END.
|
"Move to the beginning of the posting, or status marker, limit to END.
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,14 @@
|
||||||
(defconst ledger-amount-regex
|
(defconst ledger-amount-regex
|
||||||
(concat "\\( \\|\t\\| \t\\)[ \t]*-?"
|
(concat "\\( \\|\t\\| \t\\)[ \t]*-?"
|
||||||
"\\([A-Z$€£₹_(]+ *\\)?"
|
"\\([A-Z$€£₹_(]+ *\\)?"
|
||||||
"\\(-?[0-9,]+\\)"
|
;; We either match just a number after the commodity with no
|
||||||
"\\(\\.[0-9)]+\\)?"
|
;; decimal or thousand separators or a number with thousand
|
||||||
|
;; separators. If we have a decimal part starting with `,'
|
||||||
|
;; or `.', because the match is non-greedy, it must leave at
|
||||||
|
;; least one of those symbols for the following capture
|
||||||
|
;; group, which then finishes the decimal part.
|
||||||
|
"\\(-?\\(?:[0-9]+\\|[0-9,.]+?\\)\\)"
|
||||||
|
"\\([,.][0-9)]+\\)?"
|
||||||
"\\( *[[:word:]€£₹_\"]+\\)?"
|
"\\( *[[:word:]€£₹_\"]+\\)?"
|
||||||
"\\([ \t]*[@={]@?[^\n;]+?\\)?"
|
"\\([ \t]*[@={]@?[^\n;]+?\\)?"
|
||||||
"\\([ \t]+;.+?\\|[ \t]*\\)?$"))
|
"\\([ \t]+;.+?\\|[ \t]*\\)?$"))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue