diff options
author | Steve Purcell <steve@sanityinc.com> | 2014-12-09 16:26:51 +0000 |
---|---|---|
committer | Steve Purcell <steve@sanityinc.com> | 2014-12-09 16:26:51 +0000 |
commit | 01c91130d79b8ed23443507550641ffafae1b88c (patch) | |
tree | 0366a21395565e3d439b27367979e2aee563213f /lisp/ledger-state.el | |
parent | b623306591cab200cc7c69fb15ea7fe2dfc81bfd (diff) | |
download | fork-ledger-01c91130d79b8ed23443507550641ffafae1b88c.tar.gz fork-ledger-01c91130d79b8ed23443507550641ffafae1b88c.tar.bz2 fork-ledger-01c91130d79b8ed23443507550641ffafae1b88c.zip |
[emacs] Parse transaction leading lines more robustly
This began with noticing that the code didn't support the (ugly, yet
valid) case of a tab between the date and txn description. I took the
opportunity to make the regexes more consistent along the way.
Diffstat (limited to 'lisp/ledger-state.el')
-rw-r--r-- | lisp/ledger-state.el | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/ledger-state.el b/lisp/ledger-state.el index b2574b10..8fe84053 100644 --- a/lisp/ledger-state.el +++ b/lisp/ledger-state.el @@ -68,10 +68,12 @@ (defun ledger-state-from-string (state-string) "Get state from STATE-CHAR." - (cond ((string-match "\\!" state-string) 'pending) - ((string-match "\\*" state-string) 'cleared) - ((string-match ";" state-string) 'comment) - (t nil))) + (when state-string + (cond + ((string-match "\\!" state-string) 'pending) + ((string-match "\\*" state-string) 'cleared) + ((string-match ";" state-string) 'comment) + (t nil)))) (defun ledger-toggle-current-posting (&optional style) "Toggle the cleared status of the transaction under point. |