* [PATCH] Run a hook when relative timer is continued
@ 2010-12-17 13:41 Christian Moe
2010-12-20 12:20 ` Carsten Dominik
0 siblings, 1 reply; 2+ messages in thread
From: Christian Moe @ 2010-12-17 13:41 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]
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
[-- Attachment #2: org-timer.el.diff --]
[-- Type: text/plain, Size: 752 bytes --]
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
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Run a hook when relative timer is continued
2010-12-17 13:41 [PATCH] Run a hook when relative timer is continued Christian Moe
@ 2010-12-20 12:20 ` Carsten Dominik
0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2010-12-20 12:20 UTC (permalink / raw)
To: christian.moe; +Cc: emacs-orgmode
Applied, thanks.
- Carsten
On Dec 17, 2010, at 2:41 PM, Christian Moe wrote:
>
> 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
>
>
>
> <org-timer.el.diff>_______________________________________________
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-20 12:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-17 13:41 [PATCH] Run a hook when relative timer is continued Christian Moe
2010-12-20 12:20 ` Carsten Dominik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.