From ead3bbb7bf9365303c561709d72635751687b500 Mon Sep 17 00:00:00 2001 From: RĂ©mi Vanicat Date: Thu, 12 Dec 2013 18:50:10 +0100 Subject: 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. --- lisp/ledger-schedule.el | 24 +++++++++++++++++++----- 1 file 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)) -- cgit v1.2.3