From 1ca35ff6e5d1de3cfefd6bf02c438a457e2f6fc8 Mon Sep 17 00:00:00 2001 From: Leon Rische Date: Sun, 2 Feb 2020 20:08:21 +0100 Subject: Check if review history file exists before loading it --- org-fc-awk.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'org-fc-awk.el') diff --git a/org-fc-awk.el b/org-fc-awk.el index 131b432..a64182d 100644 --- a/org-fc-awk.el +++ b/org-fc-awk.el @@ -188,15 +188,17 @@ parsing each element with its header specification." (org-fc-awk--command "awk/stats_positions.awk"))))) (defun org-fc-awk-stats-reviews () - "Statistics for all card reviews." - (let ((res (org-fc-tsv-parse - org-fc-awk-review-stats-headers - (shell-command-to-string - (org-fc-awk--command - "awk/stats_reviews.awk" - :utils t - :input org-fc-review-history-file))))) - `(:all ,(first res) :month ,(second res) :week ,(third res) :day ,(fourth res)))) + "Statistics for all card reviews. +Return nil there is no history file." + (if (file-exists-p org-fc-review-history-file) + (let ((res (org-fc-tsv-parse + org-fc-awk-review-stats-headers + (shell-command-to-string + (org-fc-awk--command + "awk/stats_reviews.awk" + :utils t + :input org-fc-review-history-file))))) + `(:all ,(first res) :month ,(second res) :week ,(third res) :day ,(fourth res))))) ;;; Exports -- cgit v1.2.3