From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Alan E. Davis" Subject: Re: How to pause the relative timer Date: Mon, 5 Jan 2009 21:23:54 +1000 Message-ID: <7bef1f890901050323s23c949fdxa0e6fdbb08b08120@mail.gmail.com> References: <7bef1f890901040630r333dc928r547d77a195f2dc34@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0076333724==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LJnYt-0004fC-7I for emacs-orgmode@gnu.org; Mon, 05 Jan 2009 06:23:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LJnYr-0004dK-Ca for emacs-orgmode@gnu.org; Mon, 05 Jan 2009 06:23:58 -0500 Received: from [199.232.76.173] (port=55254 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LJnYq-0004d2-VM for emacs-orgmode@gnu.org; Mon, 05 Jan 2009 06:23:57 -0500 Received: from rv-out-0708.google.com ([209.85.198.245]:11134) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LJnYq-0005v2-AW for emacs-orgmode@gnu.org; Mon, 05 Jan 2009 06:23:56 -0500 Received: by rv-out-0708.google.com with SMTP id k29so8654028rvb.6 for ; Mon, 05 Jan 2009 03:23:54 -0800 (PST) In-Reply-To: <7bef1f890901040630r333dc928r547d77a195f2dc34@mail.gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode Mailinglist --===============0076333724== Content-Type: multipart/alternative; boundary="----=_Part_148852_27750626.1231154634780" ------=_Part_148852_27750626.1231154634780 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_148852_27750626.1231154634780 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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

------=_Part_148852_27750626.1231154634780-- --===============0076333724== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0076333724==--