Fix org-clock-load

Since commit fda64f1ae2 on November 6,
org-clock-load no longer restores clocks in org-clock-persist-file. The
contents of the file look like this:

(setq org-clock-stored-history '(("/home/matt/org/inbox.org" . 39479) ("/home/matt/org/reading.org" . 63478)))

The files both exist; the position information is correct; and
org-clock-persist is t. And yet after calling org-clock-load,
org-clock-history, org-clock-loaded, and org-clock-stored-history remain
nil.

The problem, it seems, is that the logic/order of the if statement was
reversed in the commit above. The attached patch should fix the issue.

Best,
Matt

[4. text/x-diff; 0001-org-clock-Fix-org-clock-load.patch]
From 6d649016fbbfaa28c902ee1e71c20ecf332f8a14 Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
Date: Mon, 19 Dec 2016 17:24:10 -0600
Subject: [PATCH] org-clock: Fix org-clock-load

* lisp/org-clock.el: (org-clock-load): Fix incorrect order in if
statement that was preventing org-load from loading stored data and
populating org-clock-history.
This commit is contained in:
Matt Lundin 2016-12-19 17:32:26 -06:00 committed by Nicolas Goaziou
parent 1d7f1349c9
commit 13751c3249
1 changed files with 3 additions and 3 deletions

View File

@ -2962,9 +2962,9 @@ The details of what will be saved are regulated by the variable
(defun org-clock-load ()
"Load clock-related data from disk, maybe resuming a stored clock."
(when (and org-clock-persist (not org-clock-loaded))
(if (file-readable-p org-clock-persist-file)
(message "Restoring clock data")
(message "Not restoring clock data; %S not found" org-clock-persist-file)
(if (not (file-readable-p org-clock-persist-file))
(message "Not restoring clock data; %S not found" org-clock-persist-file)
(message "Restoring clock data")
;; Load history.
(load-file org-clock-persist-file)
(setq org-clock-loaded t)