emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] BUG: org-capture saves an incorrect clock marker in org-clock-


From: Bernt Hansen
Subject: [Orgmode] BUG: org-capture saves an incorrect clock marker in org-clock-history
Date: Wed, 23 Jun 2010 22:25:46 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Hi Carsten,

I have the following templates converted from my remember templates.
I've enabled clock in and clock resume for all templates.

(global-set-key (kbd "C-c c") 'org-capture)

org-capture-templates
Value: 
(("t" "todo" entry
  (file "~/git/org/refile.org")
  "* TODO %?\n  %U\n  %a" :clock-in t :clock-resume t)
 ("n" "note" entry
  (file "~/git/org/refile.org")
  "* %?                                                                         
   :NOTE:\n  %U\n  %a\n  :CLOCK:\n  :END:" :clock-in t :clock-resume t)
 ("a" "appointment" entry
  (file+headline "~/git/org/todo.org" "Appointments")
  "* %?\n  %U" :clock-in t :clock-resume t)
 ("w" "org-protocol" entry
  (file "~/git/org/refile.org")
  "* TODO Review %c\n  %U" :immediate-finish t :clock-in t :clock-resume t))

If I try to create a simple capture note with the 't' template like
this:

C-c c t
and then file the note with C-c C-c

org-clock-history gets a marker in no buffer added to the list.

org-clock-history is a variable defined in `org-clock.el'.
Its value is 
(#<marker in no buffer> #<marker at 253 in refile.org> #<marker at 59699 in 
org.org> ...
^^^^^^^^^^^^^^^^^^^^^^^

Clocking in another task cleans up the clock history but this entry is
wrong.  I have a function mapped to F9-SPC that goes to the last clocked
in task by using the marker from org-clock-history directly and when it
hits this marker in no buffer it fails with an error.

(global-set-key (kbd "<f9> SPC") 'bh/clock-in-last-task)

(defun bh/clock-in-last-task ()
  "Clock in the interrupted task if there is one"
  (interactive)
  (let ((clock-in-to-task (if (org-clock-is-active)
                              (setq clock-in-to-task (cadr org-clock-history))
                            (setq clock-in-to-task (car org-clock-history)))))
    (org-with-point-at clock-in-to-task
      (org-clock-in nil))))

Let me know if you need any additional information.

Regards,
Bernt



reply via email to

[Prev in Thread] Current Thread [Next in Thread]