summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-12-12 11:24:07 -0800
committerCraig Earls <enderw88@gmail.com>2013-12-12 11:24:07 -0800
commit50f63a8bfdd52a60eec7fe63e9366c1f241619de (patch)
treefe41d80a3b732da5eb4f8167747fe4e1de4c38c9
parentdcd9cc4b17eaefb3930cc409814157b4d1e9e63e (diff)
parentead3bbb7bf9365303c561709d72635751687b500 (diff)
downloadfork-ledger-50f63a8bfdd52a60eec7fe63e9366c1f241619de.tar.gz
fork-ledger-50f63a8bfdd52a60eec7fe63e9366c1f241619de.tar.bz2
fork-ledger-50f63a8bfdd52a60eec7fe63e9366c1f241619de.zip
Merge pull request #223 from vanicat/t/schedule-with-args
I should have done this a long time ago, but I got too lazy. Thanks Remi!
-rw-r--r--lisp/ledger-schedule.el27
1 files changed, 21 insertions, 6 deletions
diff --git a/lisp/ledger-schedule.el b/lisp/ledger-schedule.el
index c8fd6ad0..ce77f26b 100644
--- a/lisp/ledger-schedule.el
+++ b/lisp/ledger-schedule.el
@@ -297,13 +297,28 @@ returns true if the date meets the requirements"
(ledger-mode))
(length candidates)))
-(defun ledger-schedule-upcoming ()
- (interactive)
+(defun ledger-schedule-upcoming (file look-backward look-forward)
+ "Generate upcoming transaction
+
+FILE is the file containing the scheduled transaction,
+default to `ledger-schedule-file'.
+LOOK-BACKWARD is the number of day in the past to look at
+default to `ledger-schedule-look-backward'
+LOOK-FORWARD is the number of day in the futur to look at
+default to `ledger-schedule-look-forward'
+
+Use a prefix arg to change the default value"
+ (interactive (if current-prefix-arg
+ (list (read-file-name "Schedule File: " () ledger-schedule-file t)
+ (read-number "Look backward: " ledger-schedule-look-backward)
+ (read-number "Look forward: " ledger-schedule-look-forward))
+ (list ledger-schedule-file ledger-schedule-look-backward ledger-schedule-look-forward)))
(ledger-schedule-create-auto-buffer
- (ledger-schedule-scan-transactions ledger-schedule-file)
- ledger-schedule-look-backward
- ledger-schedule-look-forward
- (current-buffer)))
+ (ledger-schedule-scan-transactions file)
+ look-backward
+ look-forward
+ (current-buffer))
+ (pop-to-buffer ledger-schedule-buffer-name))
(provide 'ledger-schedule)