summaryrefslogtreecommitdiff
path: root/lisp/ldg-mode.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-01-29 12:47:27 -0700
committerCraig Earls <enderw88@gmail.com>2013-01-29 12:47:27 -0700
commit619b6abd5ca3713a01c1fcb38a055f037cbc30af (patch)
treed81d414c3354099fca29fc996bd2ee1c21da3aca /lisp/ldg-mode.el
parent1e709d1040eb2c10f7ab0ea80e903c12fcb0f35c (diff)
downloadfork-ledger-619b6abd5ca3713a01c1fcb38a055f037cbc30af.tar.gz
fork-ledger-619b6abd5ca3713a01c1fcb38a055f037cbc30af.tar.bz2
fork-ledger-619b6abd5ca3713a01c1fcb38a055f037cbc30af.zip
Fixes the set-year and set-month functions
Also adds current year and month to the entry prompt.
Diffstat (limited to 'lisp/ldg-mode.el')
-rw-r--r--lisp/ldg-mode.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/ldg-mode.el b/lisp/ldg-mode.el
index caa57e8e..e36dc969 100644
--- a/lisp/ldg-mode.el
+++ b/lisp/ldg-mode.el
@@ -1,3 +1,16 @@
+(defsubst ledger-current-year ()
+ (format-time-string "%Y"))
+(defsubst ledger-current-month ()
+ (format-time-string "%m"))
+
+(defvar ledger-year (ledger-current-year)
+ "Start a ledger session with the current year, but make it
+customizable to ease retro-entry.")
+(defvar ledger-month (ledger-current-month)
+ "Start a ledger session with the current month, but make it
+customizable to ease retro-entry.")
+
+
(defcustom ledger-default-acct-transaction-indent " "
"Default indentation for account transactions in an entry."
:type 'string
@@ -152,7 +165,8 @@ Return the difference in the format of a time value."
(setq ledger-month (format "%02d" newmonth))))
(defun ledger-add-entry (entry-text &optional insert-at-point)
- (interactive "sEntry: ")
+ (interactive (list
+ (read-string "Entry: " (concat ledger-year "/" ledger-month "/"))))
(let* ((args (with-temp-buffer
(insert entry-text)
(eshell-parse-arguments (point-min) (point-max))))