emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <christian.moe@hf.uio.no>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Run a hook when relative timer is continued
Date: Fri, 17 Dec 2010 14:41:23 +0100	[thread overview]
Message-ID: <4D0B6883.9020908@hf.uio.no> (raw)

[-- 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

             reply	other threads:[~2010-12-17 13:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-17 13:41 Christian Moe [this message]
2010-12-20 12:20 ` [PATCH] Run a hook when relative timer is continued Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D0B6883.9020908@hf.uio.no \
    --to=christian.moe@hf.uio.no \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).