Catch value expression in amount alignment code
This commit is contained in:
parent
ec457f0ad7
commit
03bace82bd
2 changed files with 17 additions and 19 deletions
|
|
@ -109,37 +109,35 @@ region align the posting on the current line."
|
||||||
(not (use-region-p)))
|
(not (use-region-p)))
|
||||||
(set-mark (point)))
|
(set-mark (point)))
|
||||||
|
|
||||||
(let* ((inhibit-modification-hooks t)
|
(let ((inhibit-modification-hooks t)
|
||||||
(mark-first (< (mark) (point)))
|
(mark-first (< (mark) (point)))
|
||||||
(begin-region (if beg
|
|
||||||
beg
|
|
||||||
(if mark-first (mark) (point))))
|
|
||||||
(end-region (if end
|
|
||||||
end
|
|
||||||
(if mark-first (point) (mark))))
|
|
||||||
acct-start-column acct-end-column acct-adjust amt-width amt-adjust
|
acct-start-column acct-end-column acct-adjust amt-width amt-adjust
|
||||||
(lines-left 1))
|
(lines-left 1))
|
||||||
|
|
||||||
|
(unless beg (setq beg (if mark-first (mark) (point))))
|
||||||
|
(unless end (setq end (if mark-first (mark) (point))))
|
||||||
;; Condition point and mark to the beginning and end of lines
|
;; Condition point and mark to the beginning and end of lines
|
||||||
(goto-char end-region)
|
(goto-char end)
|
||||||
(setq end-region (line-end-position))
|
(setq end (line-end-position))
|
||||||
(goto-char begin-region)
|
(goto-char beg)
|
||||||
(goto-char
|
(goto-char
|
||||||
(setq begin-region
|
(setq beg
|
||||||
(line-beginning-position)))
|
(line-beginning-position)))
|
||||||
|
|
||||||
(untabify begin-region end-region)
|
(untabify beg end)
|
||||||
|
|
||||||
(goto-char end-region)
|
;; if untabify actually changed anything, then our begin and end are not correct.
|
||||||
(setq end-region (line-end-position))
|
(goto-char end)
|
||||||
(goto-char begin-region)
|
(setq end (line-end-position))
|
||||||
|
(goto-char beg)
|
||||||
(goto-char
|
(goto-char
|
||||||
(setq begin-region
|
(setq beg
|
||||||
(line-beginning-position)))
|
(line-beginning-position)))
|
||||||
|
|
||||||
;; This is the guts of the alignment loop
|
;; This is the guts of the alignment loop
|
||||||
(while (and (or (setq acct-start-column (ledger-next-account (line-end-position)))
|
(while (and (or (setq acct-start-column (ledger-next-account (line-end-position)))
|
||||||
lines-left)
|
lines-left)
|
||||||
(< (point) end-region))
|
(< (point) end))
|
||||||
(when acct-start-column
|
(when acct-start-column
|
||||||
(setq acct-end-column (save-excursion
|
(setq acct-end-column (save-excursion
|
||||||
(goto-char (match-end 2))
|
(goto-char (match-end 2))
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
|
|
||||||
(defconst ledger-amount-regex
|
(defconst ledger-amount-regex
|
||||||
(concat "\\( \\|\t\\| \t\\)[ \t]*-?"
|
(concat "\\( \\|\t\\| \t\\)[ \t]*-?"
|
||||||
"\\([A-Z$€£_]+ *\\)?"
|
"\\([A-Z$€£_(]+ *\\)?"
|
||||||
"\\(-?[0-9,\\.]+?\\)"
|
"\\(-?[0-9,\\.]+?\\)"
|
||||||
"\\(.[0-9]+\\)?"
|
"\\(.[0-9)]+\\)?"
|
||||||
"\\( *[[:word:]€£_\"]+\\)?"
|
"\\( *[[:word:]€£_\"]+\\)?"
|
||||||
"\\([ \t]*[@={]@?[^\n;]+?\\)?"
|
"\\([ \t]*[@={]@?[^\n;]+?\\)?"
|
||||||
"\\([ \t]+;.+?\\|[ \t]*\\)?$"))
|
"\\([ \t]+;.+?\\|[ \t]*\\)?$"))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue