Correct bug is edit amount.

Edit-amount was still looking for decimal-comma
This commit is contained in:
Craig Earls 2013-03-06 15:23:46 -05:00
parent 7579ebb34d
commit 63653f50d5
2 changed files with 2 additions and 11 deletions

View file

@ -323,7 +323,7 @@ at point.
@node Hiding Transactions, , Sorting Transactions, The Ledger Buffer @node Hiding Transactions, , Sorting Transactions, The Ledger Buffer
@section Hiding Transactions @section Hiding Transactions
Often you will want to run Ledger register reports just to look at a Often you will want to run Ledger register reports just to look at ax
specific set of transactions. If you don't need the running total specific set of transactions. If you don't need the running total
calculation handled by Ledger, Ledger-mode provides a rapid way of calculation handled by Ledger, Ledger-mode provides a rapid way of
narrowing what is displayed in the buffer in a way that is simpler than narrowing what is displayed in the buffer in a way that is simpler than

View file

@ -186,19 +186,10 @@ BEG, END, and LEN control how far it can align."
(let ((end-of-amount (re-search-forward "[-.,0-9]+" (line-end-position) t))) (let ((end-of-amount (re-search-forward "[-.,0-9]+" (line-end-position) t)))
;; determine if there is an amount to edit ;; determine if there is an amount to edit
(if end-of-amount (if end-of-amount
(let ((val (match-string 0))) (let ((val (ledger-commodity-string-number-decimalize (match-string 0) :from-user)))
(goto-char (match-beginning 0)) (goto-char (match-beginning 0))
(delete-region (match-beginning 0) (match-end 0)) (delete-region (match-beginning 0) (match-end 0))
(calc) (calc)
(if ledger-use-decimal-comma
(progn
(while (string-match "\\." val)
(setq val (replace-match "" nil nil val))) ;; gets rid of periods
(while (string-match "," val)
(setq val (replace-match "." nil nil val)))) ;; switch to period separator
(progn
(while (string-match "," val)
(setq val (replace-match "" nil nil val))))) ;; gets rid of commas
(calc-eval val 'push)) ;; edit the amount (calc-eval val 'push)) ;; edit the amount
(progn ;;make sure there are two spaces after the account name and go to calc (progn ;;make sure there are two spaces after the account name and go to calc
(if (search-backward " " (- (point) 3) t) (if (search-backward " " (- (point) 3) t)