emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Alan E. Davis" <lngndvs@gmail.com>
To: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: How to pause the relative timer
Date: Mon, 5 Jan 2009 21:23:54 +1000	[thread overview]
Message-ID: <7bef1f890901050323s23c949fdxa0e6fdbb08b08120@mail.gmail.com> (raw)
In-Reply-To: <7bef1f890901040630r333dc928r547d77a195f2dc34@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1831 bytes --]

Hello:

I have been able to put together a tentative solution to this problem of
pausing the relative timer.

It needs work, but perhaps one will be forgiven for posting it (below).  It
has mostly been stolen, as anyone will see:


---------------- Code --------------
(defvar org-timer-pause-time nil
  "t=0 for pause")

(defvar org-timer-pause-restart-time nil
  "t=last for pause")

(defun org-aed-pause-timer-pause ()
  "Set the time of the pause timer to the start time
of the pause interval."
  (interactive)
  (setq org-timer-pause-time (current-time))
  (let ((ind 0))
    (save-excursion
      (skip-chars-backward " \n\t")
      (condition-case nil
      (progn
        (org-beginning-of-item)
        (setq ind (org-get-indentation)))
    (error nil)))
    (or (bolp) (newline))
    (org-indent-line-to ind)
    (insert "- paused:  ")
    (org-timer)))

(defvar scnds nil)

(defun org-aed-pause-timer-restart ()
  "Get current time, calculate pause interval, do the math,
and reset org-timer-start-time"
  (interactive)
;  (setq org-timer-start-time
;    (seconds-to-time
;     (+ (time-to-seconds org-timer-start-time)
  (setq scnds (time-to-seconds org-timer-start-time))
  (setq org-timer-start-time
    (seconds-to-time
     (+ scnds
        (-
         (time-to-seconds (current-time))
         (time-to-seconds org-timer-pause-time)))))
  (let ((ind 0))
    (save-excursion
      (skip-chars-backward " \n\t")
      (condition-case nil
      (progn
        (org-beginning-of-item)
        (setq ind (org-get-indentation)))
    (error nil)))
    (or (bolp) (newline))
    (org-indent-line-to ind)
    (insert "- pause off:  ")
    (org-timer)))

------------END Code ---------------%---------------------




-- 
Alan Davis

"It's never a matter of liking or disliking ..."
      ---Santa Ynez Chumash Medicine Man

[-- Attachment #1.2: Type: text/html, Size: 3002 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

  reply	other threads:[~2009-01-05 11:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-04 14:30 How to pause the relative timer Alan E. Davis
2009-01-05 11:23 ` Alan E. Davis [this message]
2009-01-05 21:02   ` Carsten Dominik
2009-01-08 11:20 ` Carsten Dominik

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=7bef1f890901050323s23c949fdxa0e6fdbb08b08120@mail.gmail.com \
    --to=lngndvs@gmail.com \
    --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).