From f672024e06b7b03c2a9287bf75faf375955fa791 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 4 Apr 2004 11:26:32 +0000 Subject: *** empty log message *** --- ledger.el | 23 +++++++++++++---------- reports.cc | 4 +++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ledger.el b/ledger.el index 5994345a..46633c95 100644 --- a/ledger.el +++ b/ledger.el @@ -74,21 +74,24 @@ (defun ledger-add-entry (entry) (interactive - (list (read-string "Entry: " (format-time-string "%m/%d ")))) - (let ((args (mapcar 'shell-quote-argument (split-string entry))) - date entry) - (with-temp-buffer - (shell-command - (concat "ledger entry " - (mapconcat 'identity args " ")) t) - (setq date (buffer-substring (point) (+ (point) 10))) - (setq entry (buffer-substring (+ (point) 5) (point-max)))) + (list (read-string "Entry: " (format-time-string "%Y/%m/%d ")))) + (let* ((args (mapcar 'shell-quote-argument (split-string entry))) + (date (car args)) + exit-code) (if (string-match "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" date) (setq date (encode-time 0 0 0 (string-to-int (match-string 3 date)) (string-to-int (match-string 2 date)) (string-to-int (match-string 1 date))))) (ledger-find-slot date) - (insert entry))) + (save-excursion + (insert + (with-temp-buffer + (setq exit-code + (apply 'call-process "/home/johnw/bin/ledger" nil t nil + (cons "entry" args))) + (if (= 0 exit-code) + (buffer-substring (+ (point-min) 5) (point-max)) + (concat (substring entry 5) "\n\n"))))))) (defun ledger-expand-entry () (interactive) diff --git a/reports.cc b/reports.cc index 24160396..d9efac2b 100644 --- a/reports.cc +++ b/reports.cc @@ -460,7 +460,7 @@ void add_new_entry(int index, int argc, char **argv) } if (index == argc) { - std::cerr << "Error: Too few arguments to 'add'." << std::endl; + std::cerr << "Error: Too few arguments to 'entry'." << std::endl; std::exit(1); } @@ -733,6 +733,8 @@ int main(int argc, char * argv[]) delete main_ledger; #endif + + return 0; } // reports.cc ends here. -- cgit v1.2.3