*** empty log message ***

This commit is contained in:
John Wiegley 2004-04-04 11:26:32 +00:00
parent 6f3d5be613
commit f672024e06
2 changed files with 16 additions and 11 deletions

View file

@ -74,21 +74,24 @@
(defun ledger-add-entry (entry) (defun ledger-add-entry (entry)
(interactive (interactive
(list (read-string "Entry: " (format-time-string "%m/%d ")))) (list (read-string "Entry: " (format-time-string "%Y/%m/%d "))))
(let ((args (mapcar 'shell-quote-argument (split-string entry))) (let* ((args (mapcar 'shell-quote-argument (split-string entry)))
date entry) (date (car args))
(with-temp-buffer exit-code)
(shell-command
(concat "ledger entry "
(mapconcat 'identity args " ")) t)
(setq date (buffer-substring (point) (+ (point) 10)))
(setq entry (buffer-substring (+ (point) 5) (point-max))))
(if (string-match "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" date) (if (string-match "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" date)
(setq date (encode-time 0 0 0 (string-to-int (match-string 3 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 2 date))
(string-to-int (match-string 1 date))))) (string-to-int (match-string 1 date)))))
(ledger-find-slot 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 () (defun ledger-expand-entry ()
(interactive) (interactive)

View file

@ -460,7 +460,7 @@ void add_new_entry(int index, int argc, char **argv)
} }
if (index == argc) { 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); std::exit(1);
} }
@ -733,6 +733,8 @@ int main(int argc, char * argv[])
delete main_ledger; delete main_ledger;
#endif #endif
return 0;
} }
// reports.cc ends here. // reports.cc ends here.