summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2013-01-29 12:03:59 -0800
committerJohn Wiegley <johnw@newartisans.com>2013-01-29 12:03:59 -0800
commitde8974c6e51ad8e77a97c9b4d2aa89e6d5790133 (patch)
tree864ed81d0563ea730993292c601dac7d58381283
parent374598392591af6d926b55b646aa57d7cca2d638 (diff)
parent619b6abd5ca3713a01c1fcb38a055f037cbc30af (diff)
downloadfork-ledger-de8974c6e51ad8e77a97c9b4d2aa89e6d5790133.tar.gz
fork-ledger-de8974c6e51ad8e77a97c9b4d2aa89e6d5790133.tar.bz2
fork-ledger-de8974c6e51ad8e77a97c9b4d2aa89e6d5790133.zip
Merge pull request #136 from enderw88/ledger-mode-fix-year-and-month
Fixes the set-year and set-month functions
-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))))