From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Spiers Subject: Re: Automatic Elapsed Time Stamps? Date: Fri, 27 Jul 2007 21:56:21 +0100 Message-ID: <20070727205621.GA22472@atlantic.linksys.moosehall> References: Reply-To: Adam Spiers Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IEWrK-0008Vl-5O for emacs-orgmode@gnu.org; Fri, 27 Jul 2007 16:56:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IEWrI-0008VP-PW for emacs-orgmode@gnu.org; Fri, 27 Jul 2007 16:56:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IEWrI-0008VM-Ib for emacs-orgmode@gnu.org; Fri, 27 Jul 2007 16:56:24 -0400 Received: from mail.beimborn.com ([70.84.38.100]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IEWrI-0004sb-6a for emacs-orgmode@gnu.org; Fri, 27 Jul 2007 16:56:24 -0400 Received: from mail.beimborn.com (localhost.localdomain [127.0.0.1]) by mail.beimborn.com (8.12.11.20060308/8.12.8) with ESMTP id l6RKuM1g025906 for ; Fri, 27 Jul 2007 15:56:22 -0500 Received: from localhost (localhost [[UNIX: localhost]]) by mail.beimborn.com (8.12.11.20060308/8.12.11/Submit) id l6RKuMh6025901 for emacs-orgmode@gnu.org; Fri, 27 Jul 2007 21:56:22 +0100 Content-Disposition: inline In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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)))