summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRémi Vanicat <vanicat@debian.org>2013-12-12 18:50:10 +0100
committerRémi Vanicat <vanicat@debian.org>2013-12-12 18:56:16 +0100
commitead3bbb7bf9365303c561709d72635751687b500 (patch)
treefe41d80a3b732da5eb4f8167747fe4e1de4c38c9 /lisp
parentb4897a9e7cf7b4d71b61cc5a4fc80cb2f0906a43 (diff)
downloadfork-ledger-ead3bbb7bf9365303c561709d72635751687b500.tar.gz
fork-ledger-ead3bbb7bf9365303c561709d72635751687b500.tar.bz2
fork-ledger-ead3bbb7bf9365303c561709d72635751687b500.zip
ledger-schedule-upcoming take argument.
One can forget to run ledger-schedule-upcoming for some time. Then there is the risk that ledger-schedule-look-backward is too short. This will open the possibility to use a different file, or to change the period backward or forward for this kind of case.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-schedule.el24
1 files changed, 19 insertions, 5 deletions
diff --git a/lisp/ledger-schedule.el b/lisp/ledger-schedule.el
index 8790399d..ce77f26b 100644
--- a/lisp/ledger-schedule.el
+++ b/lisp/ledger-schedule.el
@@ -297,12 +297,26 @@ 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
+ (ledger-schedule-scan-transactions file)
+ look-backward
+ look-forward
(current-buffer))
(pop-to-buffer ledger-schedule-buffer-name))