Fix last task handling

This commit is contained in:
Николай Пузанов 2019-07-15 16:08:57 +03:00
parent 26c29023d8
commit a546be7f53

View File

@ -659,7 +659,7 @@
"Not specified task path. No tasks in the sheet.\n") "Not specified task path. No tasks in the sheet.\n")
(values #f #f #f)) (values #f #f #f))
(begin (begin
(stop-task last) (when last (stop-task last))
(let-values (((sheet task) (new-task sheet path))) (let-values (((sheet task) (new-task sheet path)))
(format #t "--- NEW TASK RUN\n") (format #t "--- NEW TASK RUN\n")
(print-timerecord task) (print-timerecord task)
@ -668,7 +668,7 @@
;;; Stop a running task. Returns new sheet or #f if nothing to stop. ;;; Stop a running task. Returns new sheet or #f if nothing to stop.
(define (cmd-stop-task sheet deadlines archives . params) (define (cmd-stop-task sheet deadlines archives . params)
(let ((last (last-task sheet))) (let ((last (last-task sheet)))
(if (stop-task last) (if (and last (stop-task last))
(begin (begin
(format #t "--- STOP TASK\n") (format #t "--- STOP TASK\n")
(print-timerecord last) (print-timerecord last)
@ -761,7 +761,7 @@
(lambda (break-del) (lambda (break-del)
(let ((task (if arg1 (let ((task (if arg1
(path-split arg1) (path-split arg1)
(if (null? last) (if (not last)
(begin (format #t "Not specified task path.\n") (break-del #f)) (begin (format #t "Not specified task path.\n") (break-del #f))
(car last))))) (car last)))))
(fold-right (fold-right
@ -784,7 +784,7 @@
(else (else
(let ((task (if arg0 (let ((task (if arg0
(path-split arg0) (path-split arg0)
(if (null? last) (if (not last)
(begin (format #t "--- ALL DEADLINES\n") `()) (begin (format #t "--- ALL DEADLINES\n") `())
(car last))))) (car last)))))
(for-each (for-each