all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Automatic Elapsed Time Stamps?
@ 2007-07-27 20:07 Alan Dove
  2007-07-27 20:56 ` Adam Spiers
  2007-07-27 22:44 ` Bastien
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Dove @ 2007-07-27 20:07 UTC (permalink / raw)
  To: emacs-orgmode

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?

Thanks very much.

           --Alan

--
Alan Dove, Ph.D.
alan.dove@gmail.com
917.273.0544
http://dovdox.com
Gizmo or Skype: alandove

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatic Elapsed Time Stamps?
  2007-07-27 20:07 Automatic Elapsed Time Stamps? Alan Dove
@ 2007-07-27 20:56 ` Adam Spiers
  2007-07-27 22:44 ` Bastien
  1 sibling, 0 replies; 4+ messages in thread
From: Adam Spiers @ 2007-07-27 20:56 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatic Elapsed Time Stamps?
  2007-07-27 20:07 Automatic Elapsed Time Stamps? Alan Dove
  2007-07-27 20:56 ` Adam Spiers
@ 2007-07-27 22:44 ` Bastien
  2007-07-28 16:58   ` Bastien
  1 sibling, 1 reply; 4+ messages in thread
From: Bastien @ 2007-07-27 22:44 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

Alan Dove <alan.dove@gmail.com> writes:

> In my work, I often take notes at a meeting while simultaneously
> taping it.

Same here.  In addition to what Adam sent, i see two solutions:

1. Use org-clock-in, org-clock-out and org-clock-report. 
   
   Put the time report (C-c C-x C-r) at the beginning of the first level
   of your writing, then clock (out and) in each time you insert a new
   sublevel. Make sure clock-out is not a member of `org-log-done' so
   that you won't be prompted for a log entry each time you clock out.

2. Use an `Elapsed_time' property. Here is a quick hack that could help:


[-- Attachment #2: bzg-org-step-report.el --]
[-- Type: application/emacs-lisp, Size: 1260 bytes --]

[-- Attachment #3: Type: text/plain, Size: 783 bytes --]


What it does:

  `bzg-step-time-report-initialize' will prompt for the name of the
  project. This headline have a property called "Elapsed_time". It's
  computed when you switch to the column view (C-c C-x C-x) or when you
  press C-c C-c in front of it.

  `bzg-step-time-report-add-step' will update the `Elapsed_time' value
  of the previous headline and insert a new one.

  `bzg-step-time-report-finish' will just update the `Elapsed_time'
  value of the previous headline.


Of course, this could be refined... but I hope it might help!

Regards,

PS: You might also have a look at the `run-at-time' function, but either
you need to get the time intervals between steps, or you need to know on
what frequency they are inserted, right? See (info "(elisp)Timers")

-- 
Bastien

[-- Attachment #4: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Automatic Elapsed Time Stamps?
  2007-07-27 22:44 ` Bastien
@ 2007-07-28 16:58   ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2007-07-28 16:58 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 173 bytes --]

Bastien <bzg@altern.org> writes:

> 2. Use an `Elapsed_time' property. 

I've been playing a bit with Org's property API[1]. So here is a much
cleaner version of the code:


[-- Attachment #2: bzg-step-time-report.el --]
[-- Type: application/emacs-lisp, Size: 1202 bytes --]

[-- Attachment #3: Type: text/plain, Size: 81 bytes --]


Notes: 
[1]  See (info "(Org)Using the property API") for details.

-- 
Bastien

[-- Attachment #4: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-28 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-27 20:07 Automatic Elapsed Time Stamps? Alan Dove
2007-07-27 20:56 ` Adam Spiers
2007-07-27 22:44 ` Bastien
2007-07-28 16:58   ` Bastien

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.