summaryrefslogtreecommitdiff
path: root/ledger.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-02-17 01:21:44 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:04 -0400
commit6a5465588e958bf2d1ca258c39a75f21a57d7ed8 (patch)
tree1b98a729f7df5b46376b84b8b29167ac2375ef81 /ledger.el
parent2cf6fe3fc762fcca22463c718209eb579d01e952 (diff)
downloadfork-ledger-6a5465588e958bf2d1ca258c39a75f21a57d7ed8.tar.gz
fork-ledger-6a5465588e958bf2d1ca258c39a75f21a57d7ed8.tar.bz2
fork-ledger-6a5465588e958bf2d1ca258c39a75f21a57d7ed8.zip
(ledger-add-entry): Use Eshell to do argument parsing, since that's
the easiest way to tell if '1 "2 3" 4' contains three arguments or four.
Diffstat (limited to 'ledger.el')
-rw-r--r--ledger.el18
1 files changed, 10 insertions, 8 deletions
diff --git a/ledger.el b/ledger.el
index 54f21b3b..a91c9ca2 100644
--- a/ledger.el
+++ b/ledger.el
@@ -127,7 +127,10 @@ Return the difference in the format of a time value."
(interactive
(list
(read-string "Entry: " (concat ledger-year "/" ledger-month "/"))))
- (let* ((date (car (split-string entry-text)))
+ (let* ((args (with-temp-buffer
+ (insert entry-text)
+ (eshell-parse-arguments (point-min) (point-max))))
+ (date (car args))
(insert-year t)
(ledger-buf (current-buffer))
exit-code)
@@ -145,13 +148,12 @@ Return the difference in the format of a time value."
(setq exit-code
(apply #'ledger-run-ledger
ledger-buf "entry"
- (split-string
- (with-temp-buffer
- (insert entry-text)
- (goto-char (point-min))
- (while (re-search-forward "\\([&$]\\)" nil t)
- (replace-match "\\\\\\1"))
- (buffer-string)))))
+ (mapcar
+ (function
+ (lambda (x)
+ (replace-regexp-in-string "\\([&$]\\)" "\\\\\\1"
+ (eval x))))
+ args)))
(if (= 0 exit-code)
(if insert-year
(buffer-substring 2 (point-max))