3

I use most of the setup of http://doc.norang.ca/org-mode.html. Now I want to clock in to a task by default after startup. Reason/workflow is as follows: every morning I turn on my computer and Emacs starts automatically (via GNOME autostart). In the meantime I get a coffee. And when I'm back at my desk I forget to clock in.

I tried simply calling

(run-with-idle-timer 5 nil 'bh/clock-in-organization-task-as-default)

but it doesn't work and throws me an error:

byte-code: Before first headline at position 1 in buffer *scratch*

What am I doing wrong?

  • I use something very similar based on that referenced setup from a while ago, and it works for me. It would be helpful to see the error. If it helps, I do the clocking into the default task from the after-init-hook rather than an idle timer. Also, are you sure the org-mode item with the ID can be found at this time of initialisation? Again, seeing the error would help. – Stuart Hickinbottom May 24 '16 at 11:31
  • @StuartHickinbottom you are right, I forgot the error message - sorry! I edited it in. Also notable: when calling bh/clock-in-organization-task-as-default via M-x same error appears and all org files are opened. – ckruse May 24 '16 at 11:38
  • No problem -- seeing the error after init too is a big help, I think. Are you sure you've set the bh/organization-task-id to a GUID that's defined for your default task (via "ID" in the "PROPERTIES" drawer for your default item. you can create one by putting the point in that task and running M-x org-id-copy, then making sure bh/organization-task-id is set to that same ID). – Stuart Hickinbottom May 24 '16 at 11:52
  • 1
    Uh, oh - good hint! I had a duplicate ID property on this task (dunno how this happened). After removing the duplicate one and rebuilding the location cache it works again - thanks! If you add this as answer I will accept it. :) – ckruse May 24 '16 at 12:19
3

From knowing that configuration, a good check would be to make sure that bh/organization-task-id is set to the GUID for your "default task" so that the bh/clock-in-organization-task-as-default function can correctly find it.

As a test, check that the "ID" property within the "PROPERTIES" drawer in your default task matches the ID in the bh/organization-task-id variable and ensure that the ID is actually unique. If that ID property is not set then it can be created with M-x org-id-copy when the point is in the default task.

Finally, you can make sure that Org-mode can find your default task by that ID by running M-x org-id-goto and providing that same ID. If it works then the point should jump to your default task.

From the comment above by the question poster, if the ID is found not to be unique then rebuilding the ID locations cache may be required. That can be accomplished with M-x org-id-update-id-locations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.