diff options
Diffstat (limited to 'lisp/ledger-state.el')
-rw-r--r-- | lisp/ledger-state.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/ledger-state.el b/lisp/ledger-state.el index 989e6d33..47805f15 100644 --- a/lisp/ledger-state.el +++ b/lisp/ledger-state.el @@ -1,6 +1,6 @@ ;;; ledger-state.el --- Helper code for use with the "ledger" command-line tool -;; Copyright (C) 2003-2014 John Wiegley (johnw AT gnu DOT org) +;; Copyright (C) 2003-2015 John Wiegley (johnw AT gnu DOT org) ;; This file is not part of GNU Emacs. @@ -65,6 +65,16 @@ ((eql state-char ?\;) 'comment) (t nil))) + +(defun ledger-state-from-string (state-string) + "Get state from STATE-CHAR." + (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. Optional argument STYLE may be `pending' or `cleared', depending @@ -77,7 +87,7 @@ achieved more certainly by passing the xact to ledger for formatting, but doing so causes inline math expressions to be dropped." (interactive) - (let ((bounds (ledger-find-xact-extents (point))) + (let ((bounds (ledger-navigate-find-xact-extents (point))) new-status cur-status) ;; Uncompact the xact, to make it easier to toggle the ;; transaction |