emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: How to pause the relative timer


From: Alan E. Davis
Subject: [Orgmode] Re: How to pause the relative timer
Date: Mon, 5 Jan 2009 21:23:54 +1000

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]