From mboxrd@z Thu Jan 1 00:00:00 1970 From: Austin Frank Subject: Re: [org-timer] PATCH add hooks to org-timer.el Date: Sat, 20 Feb 2010 10:02:03 -0500 Message-ID: References: <4F7FC89A-ABEA-438F-9206-F4A21B5D2D02@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1852102813==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NiqqX-0006BM-OK for emacs-orgmode@gnu.org; Sat, 20 Feb 2010 10:02:17 -0500 Received: from [140.186.70.92] (port=46675 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NiqqT-0006A5-WA for emacs-orgmode@gnu.org; Sat, 20 Feb 2010 10:02:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NiqqO-0007iV-P4 for emacs-orgmode@gnu.org; Sat, 20 Feb 2010 10:02:13 -0500 Received: from lo.gmane.org ([80.91.229.12]:38906) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NiqqO-0007iQ-C3 for emacs-orgmode@gnu.org; Sat, 20 Feb 2010 10:02:08 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1NiqqM-0002T3-Sw for emacs-orgmode@gnu.org; Sat, 20 Feb 2010 16:02:06 +0100 Received: from wireless.hlp.rochester.edu ([128.151.52.3]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 20 Feb 2010 16:02:06 +0100 Received: from austin.frank by wireless.hlp.rochester.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 20 Feb 2010 16:02:06 +0100 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@gnu.org --===============1852102813== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= On Sat, Feb 20 2010, Carsten Dominik wrote: >> @@ -317,7 +346,10 @@ VALUE can be `on', `off', or `pause'." >> + (setq org-timer-mode-line-timer >> + (run-with-timer 1 1 'org-timer-update-mode- >> line)) > > Could you please coment on the above section? What exactly is it > doing and why? These two lines were left in accidentally. This was my initial attempt at addressing the issue I brought up in my other post about putting countdown timers in the mode line. It didn't work and can be removed. A clean patch is attached. Thanks, /au --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-add-hooks-to-start-stop-pause-functions-for-relative.patch Content-Transfer-Encoding: quoted-printable From=20ec22f579f9c1fe3169e6103ad05d05658ab90f8e Mon Sep 17 00:00:00 2001 From: Austin F. Frank Date: Sat, 20 Feb 2010 09:42:48 -0500 Subject: [PATCH] add hooks to start/stop/pause functions for relative and c= ountdown timers =2D-- lisp/org-timer.el | 34 ++++++++++++++++++++++++++++++++-- 1 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lisp/org-timer.el b/lisp/org-timer.el index ed5a423..9cee0b4 100644 =2D-- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -48,6 +48,31 @@ the value of the relative timer." :group 'org-time :type 'string) =20 +(defcustom org-timer-start-hook nil + "Hook run after relative timer is started." + :group 'org-time + :type 'hook) + +(defvar org-timer-stop-hook nil + "Hook run before relative timer is stopped." + :group 'org-time + :type 'hook) + +(defvar org-timer-pause-hook nil + "Hook run before relative timer is paused." + :group 'org-time + :type 'hook) + +(defvar org-timer-set-hook nil + "Hook run after countdown timer is set." + :group 'org-time + :type 'hook) + +(defvar org-timer-cancel-hook nil + "Hook run before countdown timer is canceled." + :group 'org-time + :type 'hook) + ;;;###autoload (defun org-timer-start (&optional offset) "Set the starting time for the relative timer to now. @@ -82,7 +107,8 @@ the region 0:00:00." (org-timer-set-mode-line 'on) (message "Timer start time set to %s, current value is %s" (format-time-string "%T" org-timer-start-time) =2D (org-timer-secs-to-hms (or delta 0)))))) + (org-timer-secs-to-hms (or delta 0))) + (run-hooks 'org-timer-start-hook)))) =20 (defun org-timer-pause-or-continue (&optional stop) "Pause or continue the relative timer. With prefix arg, stop it entirel= y." @@ -102,6 +128,7 @@ the region 0:00:00." (org-timer-set-mode-line 'on) (message "Timer continues at %s" (org-timer-value-string))) (t + (run-hooks 'org-timer-pause-hook) ;; pause timer (setq org-timer-pause-time (current-time)) (org-timer-set-mode-line 'pause) @@ -110,6 +137,7 @@ the region 0:00:00." (defun org-timer-stop () "Stop the relative timer." (interactive) + (run-hooks 'org-timer-stop-hook) (setq org-timer-start-time nil org-timer-pause-time nil) (org-timer-set-mode-line 'off)) @@ -264,6 +292,7 @@ VALUE can be `on', `off', or `pause'." (interactive) (mapc (lambda(timer) (when (eval timer) + (run-hooks 'org-timer-cancel-hook) (cancel-timer timer) (setq timer nil))) '(org-timer-timer1 @@ -317,7 +346,8 @@ VALUE can be `on', `off', or `pause'." (setq org-timer-last-timer (run-with-timer secs nil 'org-notify (format "%s: time out" hl) t)) =2D (set timer org-timer-last-timer))) + (set timer org-timer-last-timer) + (run-hooks 'org-timer-set-hook))) '(org-timer-timer1 org-timer-timer2 org-timer-timer3))))) =2D-=20 1.7.0 --=-=-= Content-Transfer-Encoding: quoted-printable =2D-=20 Austin Frank http://aufrank.net GPG Public Key (D7398C2F): http://aufrank.net/personal.asc --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iEYEARECAAYFAkt/+WwACgkQlHMl2/XbR4EZUwCfR/Mg6GVEHLSu7DmlP8MuhEKm fSsAnjgcTIBVz9CJ/GZmvb59rKhby0Sh =efLw -----END PGP SIGNATURE----- --==-=-=-- --===============1852102813== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1852102813==--