From 19baf228c0b257f2e338bffc4c6989fbee885c3d Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 9 Feb 2019 00:41:15 +0100 Subject: [PATCH] org-habit: Silence byte-compiler * lisp/org-habit.el (org-habit-build-graph): Silence byte-compiler. Tiny refactoring. --- lisp/org-habit.el | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/lisp/org-habit.el b/lisp/org-habit.el index 8e5f57943..2ef1b7af4 100644 --- a/lisp/org-habit.el +++ b/lisp/org-habit.el @@ -388,27 +388,22 @@ current time." (throw :exit s)))))))))) donep))) markedp face) - (if donep - (let ((done-time (time-add - starting - (days-to-time - (- start (time-to-days starting)))))) - - (aset graph index org-habit-completed-glyph) - (setq markedp t) - (while (and done-dates - (= start (car done-dates))) - (setq last-done-date (car done-dates) - done-dates (cdr done-dates)))) - (if todayp - (aset graph index org-habit-today-glyph))) + (cond + (donep + (aset graph index org-habit-completed-glyph) + (setq markedp t) + (while (and done-dates (= start (car done-dates))) + (setq last-done-date (car done-dates)) + (setq done-dates (cdr done-dates)))) + (todayp + (aset graph index org-habit-today-glyph))) (setq face (if (or in-the-past-p todayp) (car faces) (cdr faces))) - (if (and in-the-past-p - (not (eq face 'org-habit-overdue-face)) - (not markedp)) - (setq face (cdr faces))) + (when (and in-the-past-p + (not (eq face 'org-habit-overdue-face)) + (not markedp)) + (setq face (cdr faces))) (put-text-property index (1+ index) 'face face graph) (put-text-property index (1+ index) 'help-echo @@ -416,7 +411,7 @@ current time." (org-time-stamp-format) (time-add starting (days-to-time (- start (time-to-days starting))))) (if donep " DONE" "")) - graph)) + graph)) (setq start (1+ start) index (1+ index))) graph))