[EMAIL PROTECTED] (J. David Boyd) writes:

>> Any idea why this happens ?
>>
>> Cheers,
>> Cezar
>
> Are you exiting Emacs while the clock is started, then restarting
> Emacs, and attempting to clock out of an item? I have seen your error
> message when I do that.

If you try to kill a buffer with a running clock, Org asks you whether
you want to clock out.  

If you're not in the buffer where the clock runs, you are still able to
see whether a clock is running: the clocked heading is displayed in the
mode-line.

If you still want to check for a running clock before closing Emacs, you
could perhaps do this:

------------------------------------------------------------------------
(defun org-check-running-clock-any-buffer ()
  "Check if any Org buffer contains a running clock.
If yes, offer to stop it and to save the buffer with the changes."
  (interactive)
  (let ((buf (marker-buffer org-clock-marker))
        (wcf (current-window-configuration)))
    (when 
        (and buf
             (y-or-n-p 
              (format "Clock-out in buffer %s before killing it? " buf)))
      (switch-to-buffer buf)
      (org-clock-out)
      (when (y-or-n-p "Save changed buffer? ")
        (save-buffer))
      (set-window-configuration wcf))))

(defadvice save-buffers-kill-emacs
  (before org-check-running-clock activate)
  "Check for a running clock before quitting."
  (org-check-running-clock-any-buffer))
------------------------------------------------------------------------

-- 
Bastien


_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to