emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Fix org-clock-load
Date: Mon, 19 Dec 2016 17:32:26 -0600	[thread overview]
Message-ID: <8760mfcx6d.fsf@fastmail.fm> (raw)

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

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

--8<---------------cut here---------------start------------->8---
(setq org-clock-stored-history '(("/home/matt/org/inbox.org" . 39479) ("/home/matt/org/reading.org" . 63478)))
--8<---------------cut here---------------end--------------->8---

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-clock-Fix-org-clock-load.patch --]
[-- Type: text/x-diff, Size: 1262 bytes --]

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.
---
 lisp/org-clock.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 65c13fdf2..6e58ce91a 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -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)
-- 
2.11.0


             reply	other threads:[~2016-12-19 23:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 23:32 Matt Lundin [this message]
2016-12-20 17:01 ` [PATCH] Fix org-clock-load Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8760mfcx6d.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).