emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adam Spiers <adam@spiers.net>
To: emacs-orgmode@gnu.org
Subject: Re: Automatic Elapsed Time Stamps?
Date: Fri, 27 Jul 2007 21:56:21 +0100	[thread overview]
Message-ID: <20070727205621.GA22472@atlantic.linksys.moosehall> (raw)
In-Reply-To: <D3D0E17D-AD4D-4382-91BA-34009ADF2CDD@gmail.com>

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)))

  reply	other threads:[~2007-07-27 20:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-27 20:07 Automatic Elapsed Time Stamps? Alan Dove
2007-07-27 20:56 ` Adam Spiers [this message]
2007-07-27 22:44 ` Bastien
2007-07-28 16:58   ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070727205621.GA22472@atlantic.linksys.moosehall \
    --to=adam@spiers.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).