diff options
author | Craig Earls <enderw88@gmail.com> | 2013-02-12 16:04:02 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-02-12 16:04:02 -0700 |
commit | 5eb322c0a29bcf2ddaa30bfaab577f18bb1fd922 (patch) | |
tree | 13e3f575b0fa40ce19912b135ef98c823e42980e /lisp/ldg-post.el | |
parent | 28659c58c3b0531e0f5fb01b298fcb8a8f63991e (diff) | |
download | fork-ledger-5eb322c0a29bcf2ddaa30bfaab577f18bb1fd922.tar.gz fork-ledger-5eb322c0a29bcf2ddaa30bfaab577f18bb1fd922.tar.bz2 fork-ledger-5eb322c0a29bcf2ddaa30bfaab577f18bb1fd922.zip |
Comment and code cleanup
Diffstat (limited to 'lisp/ldg-post.el')
-rw-r--r-- | lisp/ldg-post.el | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/ldg-post.el b/lisp/ldg-post.el index 7b6ac9d5..099db1c2 100644 --- a/lisp/ldg-post.el +++ b/lisp/ldg-post.el @@ -63,8 +63,8 @@ (defun ledger-post-completing-read (prompt choices) "Use iswitchb as a completing-read replacement to choose from choices. -PROMPT is a string to prompt with. CHOICES is a list of strings -to choose from." + PROMPT is a string to prompt with. CHOICES is a list of + strings to choose from." (cond (ledger-post-use-iswitchb (let* ((iswitchb-use-virtual-buffers nil) @@ -113,7 +113,8 @@ to choose from." (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." + This is done so that the last digit falls in COLUMN, which + defaults to 52." (interactive "p") (if (or (null column) (= column 1)) (setq column ledger-post-amount-alignment-column)) @@ -157,17 +158,18 @@ This is done so that the last digit falls in COLUMN, which defaults to 52." (interactive) (goto-char (line-beginning-position)) (when (re-search-forward ledger-post-line-regexp (line-end-position) t) - (goto-char (match-end ledger-regex-post-line-group-account)) ;go to the and of the account - (let ((end-of-amount (re-search-forward "[-.,0-9]+" (line-end-position) t))) ;determine if there is an amount to edit + (goto-char (match-end ledger-regex-post-line-group-account)) ;; go to the and of the account + (let ((end-of-amount (re-search-forward "[-.,0-9]+" (line-end-position) t))) + ;; determine if there is an amount to edit (if end-of-amount (let ((val (match-string 0))) (goto-char (match-beginning 0)) (delete-region (match-beginning 0) (match-end 0)) (calc) (while (string-match "," val) - (setq val (replace-match "" nil nil val))) ;gets rid of commas - (calc-eval val 'push)) ;edit the amount - (progn ;make sure there are two spaces after the account name and go to calc + (setq val (replace-match "" nil nil val))) ;; gets rid of commas + (calc-eval val 'push)) ;; edit the amount + (progn ;;make sure there are two spaces after the account name and go to calc (if (search-backward " " (- (point) 3) t) (goto-char (line-end-position)) (insert " ")) |