From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: [PATCH] Run a hook when relative timer is continued Date: Fri, 17 Dec 2010 14:41:23 +0100 Message-ID: <4D0B6883.9020908@hf.uio.no> Reply-To: christian.moe@hf.uio.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090400080003020005080409" Return-path: Received: from [140.186.70.92] (port=38351 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PTaWU-0005Dc-Gk for emacs-orgmode@gnu.org; Fri, 17 Dec 2010 08:39:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PTaWT-0005mj-5t for emacs-orgmode@gnu.org; Fri, 17 Dec 2010 08:39:02 -0500 Received: from mars.hitrost.net ([91.185.211.18]:59068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PTaWS-0005mR-Sq for emacs-orgmode@gnu.org; Fri, 17 Dec 2010 08:39:01 -0500 Received: from lk.92.63.17.213.dc.cable.static.lj-kabel.net ([92.63.17.213] helo=Celebrian.local) by mars.hitrost.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1PTaWP-0000f2-B7 for emacs-orgmode@gnu.org; Fri, 17 Dec 2010 14:38:57 +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 This is a multi-part message in MIME format. --------------090400080003020005080409 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Timer: Run a hook when relative timer is continued * lisp/org-timer.el (org-timer-continue-hook): Define the variable (org-timer-pause-or-continue): Run hook after relative timer is continued There was a hook run when the relative timer is paused (and for most other actions), but none for continuing afterwards. One use for this would be to pause/continue playback in a media-player app with the same keystroke used to pause/continue the timer. TINYCHANGE ---- diff --git a/lisp/org-timer.el b/lisp/org-timer.el index bac1187..ca0f838 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -65,6 +65,9 @@ When 0, the user is prompted for a value." (defvar org-timer-pause-hook nil "Hook run before relative timer is paused.") +(defvar org-timer-continue-hook nil + "Hook run after relative timer is continued.") + (defvar org-timer-set-hook nil "Hook run after countdown timer is set.") @@ -128,6 +131,7 @@ With prefix arg STOP, stop it entirely." (org-float-time org-timer-start-time)))) org-timer-pause-time nil) (org-timer-set-mode-line 'on) + (run-hooks 'org-timer-continue-hook) (message "Timer continues at %s" (org-timer-value-string))) (t ;; pause timer -- Christian Moe E-mail: mail@christianmoe.com Website: http://christianmoe.com --------------090400080003020005080409 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="org-timer.el.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="org-timer.el.diff" diff --git a/lisp/org-timer.el b/lisp/org-timer.el index bac1187..ca0f838 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -65,6 +65,9 @@ When 0, the user is prompted for a value." (defvar org-timer-pause-hook nil "Hook run before relative timer is paused.") +(defvar org-timer-continue-hook nil + "Hook run after relative timer is continued.") + (defvar org-timer-set-hook nil "Hook run after countdown timer is set.") @@ -128,6 +131,7 @@ With prefix arg STOP, stop it entirely." (org-float-time org-timer-start-time)))) org-timer-pause-time nil) (org-timer-set-mode-line 'on) + (run-hooks 'org-timer-continue-hook) (message "Timer continues at %s" (org-timer-value-string))) (t ;; pause timer --------------090400080003020005080409 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 --------------090400080003020005080409--