[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: no running clock
From: |
Bastien |
Subject: |
Re: [Orgmode] Re: no running clock |
Date: |
Wed, 03 Oct 2007 21:44:36 +0100 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.0 (gnu/linux) |
address@hidden (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