diff options
author | John Wiegley <johnw@newartisans.com> | 2005-05-26 06:54:32 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:09 -0400 |
commit | 0fdc3d67b6e082d6ace7ae8102a417f364deb899 (patch) | |
tree | 93abd47b86cad4ce28eb0bdc894e8d4db013a50d /ledger.el | |
parent | 5bc7f5d05716c5423ade1d7a6329e999f6e67cdd (diff) | |
download | fork-ledger-0fdc3d67b6e082d6ace7ae8102a417f364deb899.tar.gz fork-ledger-0fdc3d67b6e082d6ace7ae8102a417f364deb899.tar.bz2 fork-ledger-0fdc3d67b6e082d6ace7ae8102a417f364deb899.zip |
(ledger-do-reconcile): If no output at all is generated by the "emacs"
command, do not trigger a Lisp error.
Diffstat (limited to 'ledger.el')
-rw-r--r-- | ledger.el | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -138,9 +138,10 @@ Return the difference in the format of a time value." (ledger-buf (current-buffer)) 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))))) + (setq date + (encode-time 0 0 0 (string-to-number (match-string 3 date)) + (string-to-number (match-string 2 date)) + (string-to-number (match-string 1 date))))) (ledger-find-slot date) (save-excursion (if (re-search-backward "^Y " nil t) @@ -328,6 +329,10 @@ Return the difference in the format of a time value." (set-buffer-modified-p nil) (ledger-display-balance)) +(defun ledger-reconcile-quit () + (interactive) + (kill-buffer (current-buffer))) + (defun ledger-reconcile-finish () (interactive) (save-excursion @@ -351,9 +356,10 @@ Return the difference in the format of a time value." (ledger-run-ledger buf "--uncleared" "emacs" account))) (when (= 0 exit-code) (goto-char (point-min)) - (unless (looking-at "(") - (error (buffer-string))) - (read (current-buffer))))))) + (unless (eobp) + (unless (looking-at "(") + (error (buffer-string))) + (read (current-buffer)))))))) (dolist (item items) (dolist (xact (nthcdr 6 item)) (let ((beg (point)) @@ -408,11 +414,7 @@ Return the difference in the format of a time value." (define-key map [?p] 'previous-line) (define-key map [?r] 'ledger-auto-reconcile) (define-key map [?s] 'ledger-reconcile-save) - (define-key map [?q] - (function - (lambda () - (interactive) - (kill-buffer (current-buffer))))) + (define-key map [?q] 'ledger-reconcile-quit) (use-local-map map))) ;; A sample function for $ users |