From: "Alan E. Davis" <lngndvs@gmail.com>
To: Carsten Dominik <dominik@science.uva.nl>
Cc: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: Re: Relative clocking [Further discussion and ideas by OP]
Date: Tue, 25 Nov 2008 18:08:24 +1000 [thread overview]
Message-ID: <7bef1f890811250008l2c345ae6y3069fda96fe2cf20@mail.gmail.com> (raw)
In-Reply-To: <D303C6F0-31CF-467D-AE71-DBB39F482479@uva.nl>
[-- Attachment #1.1: Type: text/plain, Size: 3320 bytes --]
You may understand that I was already looking at the idea of converting
integer times back and forth to/from hh:mm:ss. Your functions look
extremely interesting.
I am trying to write a function to start the clock at a specific point in
time. This could be useful when restarting or continuing a video, and
continuing notes.
Thank you again,
Alan
On Tue, Nov 25, 2008 at 5:07 PM, Carsten Dominik <dominik@science.uva.nl>wrote:
>
> On Nov 24, 2008, at 9:31 PM, Alan E. Davis wrote:
>
> Thank you for the reply.
>
> On Mon, Nov 24, 2008 at 8:30 PM, Carsten Dominik <dominik@science.uva.nl>wrote:
>
>> Why would you want to turn off the clock? It is actually
>> not running, only a starting time is recorded. Just "start"
>> it again when you need a new clock.
>>
>
> Perfect! Thank you.
>
>>
>>
>> A further suggestion is born or my initial experiment with his function: I
>> started the clock a bit too late, so all the timestamps are off by about
>> 30-40 seconds. Is it (at least in theory) possible to adjust all time
>> stamps in a subtree by the same amount? That would enable me to correct all
>> of my notes in one fell stroke.
>>
>>
>> Of course this is possible, but code for that would need to be written.
>>
>>
>
> I have written some elisp, not alot. May I request a clue where to start?
>
>
> Well write a function searching for the strings and change them... :-)
>
> Something like this (untested) might do it. These functions
> handle negative times, so you can also use this to change
> the timings relative to the beginning of a scene, so that a prelude
> to a scene might be at negative times.....:
>
> (defun my-change-times-in-region (beg end delta)
> "Change all h:mm:ss time in region by a DELTA."
> (interactive "r\nsEnter time difference like \"-1:08:26\" or \"0:00:25\":
> ")
> (let ((re "[-+]?[0-9]+:[0-9]\\{2\\}:[0-9]\\{2\\}")
> (delta (my-hms-to-secs delta))
> old new p)
> (when (= delta 0) (error "No change"))
> (save-excursion
> (goto-char end)
> (while (re-search-backward re beg t)
> (setq p (point))
> (replace-match
> (save-match-data
> (my-secs-to-hms (+ (my-hms-to-secs (match-string 0)) delta)))
> t t)
> (goto-char p)))))
>
> (defun my-hms-to-secs (hms)
> "Convert h:mm:ss string to an integer time.
> If the string starts with a minus sign, the integer will be negative."
> (if (not (string-match
> "\\([-+]?[0-9]+\\):\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)"
> hms))
> 0
> (let* ((h (string-to-int (match-string 1 hms)))
> (m (string-to-int (match-string 2 hms)))
> (s (string-to-int (match-string 3 hms)))
> (sign (equal (substring (match-string 1 hms) 0 1) "-")))
> (setq h (abs h))
> (* (if sign -1 1) (+ s (* 60 (+ m (* 60 h))))))))
>
> (defun my-secs-to-hms (s)
> "Convert integer S into h:mm:ss.
> If the integer is negative, the strig will start with \"-\"."
> (let (sign m h)
> (setq sign (if (< s 0) "-" "")
> s (abs s)
> m (/ s 60) s (- s (* 60 m))
> h (/ m 60) m (- m (* 60 h)))
> (format "%s%d:%02d:%02d" sign h m s)))
>
> HTH
>
> - Carsten
>
>
> Hmmm, looks useful to me also for general note taking, maybe
> I can add something linke this to Org....
>
>
--
Alan Davis
"It's never a matter of liking or disliking ..."
---Santa Ynez Chumash Medicine Man
[-- Attachment #1.2: Type: text/html, Size: 6070 bytes --]
[-- Attachment #2: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2008-11-25 8:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-24 7:47 Relative clocking [Further discussion and ideas by OP] Alan E. Davis
2008-11-24 10:30 ` Carsten Dominik
2008-11-24 20:31 ` Alan E. Davis
2008-11-25 7:07 ` Carsten Dominik
2008-11-25 8:08 ` Alan E. Davis [this message]
2008-11-25 11:29 ` Carsten Dominik
2008-11-25 11:48 ` Charles Sebold
2008-11-25 13:27 ` Carsten Dominik
2008-11-25 21:44 ` Alan E. Davis
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=7bef1f890811250008l2c345ae6y3069fda96fe2cf20@mail.gmail.com \
--to=lngndvs@gmail.com \
--cc=dominik@science.uva.nl \
--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).