summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2018-04-11 17:26:15 -0700
committerSean Whitton <spwhitton@spwhitton.name>2018-04-11 17:26:15 -0700
commit6c4148985cb88acf4b3b200b6bf26d71867e808c (patch)
tree35595bdc847c96f31064a4b362cf142dd9eabf3b
parentdfd0ca952e3a947df363fbcb55a18e9b9d2299db (diff)
redtick--save-history does nothing if redtick-history-file is nil
That means the user who doesn't want to save history can set/customise redtick-history-file to nil and there will be no error when redtick-after-rest-hook fires.
-rw-r--r--redtick.el17
1 files changed, 9 insertions, 8 deletions
diff --git a/redtick.el b/redtick.el
index 7094521..896a5f0 100644
--- a/redtick.el
+++ b/redtick.el
@@ -249,14 +249,15 @@
(defun redtick--save-history ()
"Adding current-pomodoro info to history file."
- (let ((history (redtick--load redtick-history-file)))
- (redtick--save redtick-history-file
- (add-to-list 'history
- (list redtick--pomodoro-started-at
- redtick-work-interval
- redtick-rest-interval
- redtick--pomodoro-description)
- t))))
+ (when redtick-history-file
+ (let ((history (redtick--load redtick-history-file)))
+ (redtick--save redtick-history-file
+ (add-to-list 'history
+ (list redtick--pomodoro-started-at
+ redtick-work-interval
+ redtick-rest-interval
+ redtick--pomodoro-description)
+ t)))))
(add-hook 'redtick-after-rest-hook #'redtick--save-history)