[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Automatic Elapsed Time Stamps?
From: |
Adam Spiers |
Subject: |
Re: [Orgmode] Automatic Elapsed Time Stamps? |
Date: |
Fri, 27 Jul 2007 21:56:21 +0100 |
User-agent: |
Mutt/1.5.14 (2007-02-12) |
On Fri, Jul 27, 2007 at 04:07:39PM -0400, Alan Dove wrote:
> Hey, folks:
>
> In my work, I often take notes at a meeting while simultaneously
> taping it. To refer back to specific parts of the tape later, I
> periodically check the elapsed time on the digital recorder, and
> enter that in my notes (which I take in org-mode, of course). This
> works, but it seems to me there should be a better solution. Given
> all of org-mode's timestamp and clocking capabilities, is there some
> way I can start a clock, then have it automatically insert stamps
> with the elapsed time at set intervals as I type? If not, can anyone
> suggest some elisp functions I might explore to try to hack this
> together as a macro?
I was about to point you in the direction of the Elisp info pages, but
then got interested in the interfaces, and quickly realised it
wouldn't take many more minutes to write the code myself. If you
still want the fun of writing it yourself, look away now! :-)
(defun clock-start ()
"Starts a clock which can then be used by
`clock-insert-elapsed' to insert elapsed time into the current buffer."
(interactive)
(setq clock-start (current-time)))
(defun clock-time-elapsed ()
"Returns the elapsed time since the clock was started with `clock-start'."
(interactive)
(let* ((elapsed (truncate (float-time (time-since clock-start))))
(secs (% elapsed 60))
(mins (/ elapsed 60))
(hours (/ mins 60)))
(format "%d:%02d:%02d" hours mins secs)))
(defun clock-insert-elapsed ()
"Inserts the elapsed time since the clock was started with `clock-start'."
(interactive)
(insert "CLOCK: " (clock-time-elapsed)))