emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Devin Homan <devinwh7@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: org-timer-set-timer org-notify message and sound arguments
Date: Tue, 03 Sep 2013 17:51:54 -0800	[thread overview]
Message-ID: <5226923A.5050803@gmail.com> (raw)

Here is a `git diff -p org-timer.el' of the changes that I am proposing.

diff --git a/lisp/org-timer.el b/lisp/org-timer.el
index 2351c4c..cb0ce45 100644
--- a/lisp/org-timer.el
+++ b/lisp/org-timer.el
@@ -93,6 +93,25 @@ nil          current timer is not displayed"
 (defvar org-timer-cancel-hook nil
   "Hook run before countdown timer is canceled.")

+(defvar org-timer-message nil
+  "Message displayed after countdown timer reaches zero. If
+  org-timer-message is not a string, then the default message
+  will be displayed.")
+
+(defcustom org-timer-clock-sound t
+  "Sound to play after the countdown timer reaches zero.
+Possible values are:
+
+nil        No sound played
+t          Standard Emacs beep
+file name  Play this sound file, fall back to beep"
+  :group 'org-time
+  ;; type is equivalent to `org-clock-sound'
+  :type '(choice
+	  (const :tag "No sound" nil)
+	  (const :tag "Standard beep" t)
+	  (file  :tag "Play sound file")))
+
 ;;;###autoload
 (defun org-timer-start (&optional offset)
   "Set the starting time for the relative timer to now.
@@ -400,6 +419,7 @@ replace any running timer."
       (let* ((mins (string-to-number (match-string 0 minutes)))
 	     (secs (* mins 60))
 	     (hl (cond
+		  ((stringp org-timer-message) org-timer-message)
 		  ((string-match "Org Agenda" (buffer-name))
 		   (let* ((marker (or (get-text-property (point) 'org-marker)
 				      (org-agenda-error)))
@@ -429,7 +449,7 @@ replace any running timer."
 		    (run-with-timer
 		     secs nil `(lambda ()
 				 (setq org-timer-current-timer nil)
-				 (org-notify ,(format "%s: time out" hl) t)
+				 (org-notify ,(format "%s: time out" hl) ,org-timer-clock-sound)
 				 (setq org-timer-timer-is-countdown nil)
 				 (org-timer-set-mode-line 'off)
 				 (run-hooks 'org-timer-done-hook))))

             reply	other threads:[~2013-09-04  1:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04  1:51 Devin Homan [this message]
2013-09-16 15:08 ` org-timer-set-timer org-notify message and sound arguments Bastien
  -- strict thread matches above, loose matches on Subject: below --
2013-09-03  7:10 Devin Homan

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=5226923A.5050803@gmail.com \
    --to=devinwh7@gmail.com \
    --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).