summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2014-11-26 15:47:55 -0700
committerCraig Earls <enderw88@gmail.com>2014-11-26 15:47:55 -0700
commit06bdf1d18a41202e1550dca63d64d6c8f31c7a85 (patch)
treee7dbea4dcd5bb8bcf2acce1abd76184957c19882 /lisp
parent2f698269f4a5d51235089a48cd5058fe3534f34e (diff)
downloadfork-ledger-06bdf1d18a41202e1550dca63d64d6c8f31c7a85.tar.gz
fork-ledger-06bdf1d18a41202e1550dca63d64d6c8f31c7a85.tar.bz2
fork-ledger-06bdf1d18a41202e1550dca63d64d6c8f31c7a85.zip
Minor code cleanup
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-schedule.el33
1 files changed, 16 insertions, 17 deletions
diff --git a/lisp/ledger-schedule.el b/lisp/ledger-schedule.el
index 0a7e44cd..820fa660 100644
--- a/lisp/ledger-schedule.el
+++ b/lisp/ledger-schedule.el
@@ -239,25 +239,24 @@ the transaction should be logged for that day."
(months (mapcar 'string-to-number (split-string month-desc ",")))
(day-parts (split-string day-desc "+"))
(every-nth (string-match "+" day-desc)))
- (when every-nth
- (let ((base-day (string-to-number (car day-parts)))
- (increment (string-to-number (substring (cadr day-parts) 0
- (string-match "[A-Za-z]" (cadr day-parts)))))
- (day-of-week (ledger-schedule-encode-day-of-week
- (substring (cadr day-parts) (string-match "[A-Za-z]" (cadr day-parts))))))
- (ledger-schedule-constrain-every-count-day day-of-week increment (encode-time 0 0 0 base-day (car months) (car years)))
- ))))
+ (if every-nth
+ (let ((base-day (string-to-number (car day-parts)))
+ (increment (string-to-number (substring (cadr day-parts) 0
+ (string-match "[A-Za-z]" (cadr day-parts)))))
+ (day-of-week (ledger-schedule-encode-day-of-week
+ (substring (cadr day-parts) (string-match "[A-Za-z]" (cadr day-parts))))))
+ (ledger-schedule-constrain-every-count-day day-of-week increment (encode-time 0 0 0 base-day (car months) (car years)))))))
(defun ledger-schedule-list-upcoming-xacts (candidate-items early horizon)
- "Search CANDIDATE-ITEMS for xacts that occur within the period today - EARLY to today + HORIZON"
- (let ((start-date (time-subtract (current-time) (days-to-time early)))
- test-date items)
- (loop for day from 0 to (+ early horizon) by 1 do
- (setq test-date (time-add start-date (days-to-time day)))
- (dolist (candidate candidate-items items)
- (if (funcall (car candidate) test-date)
- (setq items (append items (list (list test-date (cadr candidate))))))))
- items))
+ "Search CANDIDATE-ITEMS for xacts that occur within the period today - EARLY to today + HORIZON"
+ (let ((start-date (time-subtract (current-time) (days-to-time early)))
+ test-date items)
+ (loop for day from 0 to (+ early horizon) by 1 do
+ (setq test-date (time-add start-date (days-to-time day)))
+ (dolist (candidate candidate-items items)
+ (if (funcall (car candidate) test-date)
+ (setq items (append items (list (list test-date (cadr candidate))))))))
+ items))
(defun ledger-schedule-already-entered (candidate buffer)
"return TRUE if CANDIDATE is already in BUFFER"