emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-timer-set-timer org-notify message and sound arguments
@ 2013-09-03  7:10 Devin Homan
  0 siblings, 0 replies; 3+ messages in thread
From: Devin Homan @ 2013-09-03  7:10 UTC (permalink / raw)
  To: emacs-orgmode

The current implementation of org-timer-set-timer calls org-notify with
the PLAY-SOUND argument set to 't', which gets passed to
org-clock-play-sound that then in turn calls the beep function. The
value of this argument should be defined in a defvar so as to allow the
user to modify or dynamically set its value. Additionally, a similar
behaviour should be allowed for the message by having the first cond
case, in the cond that sets hl, return the value of a defvar should that
defvar be a string type.

Sincerely,

Devin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-timer-set-timer org-notify message and sound arguments
@ 2013-09-04  1:51 Devin Homan
  2013-09-16 15:08 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: Devin Homan @ 2013-09-04  1:51 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: org-timer-set-timer org-notify message and sound arguments
  2013-09-04  1:51 org-timer-set-timer org-notify message and sound arguments Devin Homan
@ 2013-09-16 15:08 ` Bastien
  0 siblings, 0 replies; 3+ messages in thread
From: Bastien @ 2013-09-16 15:08 UTC (permalink / raw)
  To: Devin Homan; +Cc: emacs-orgmode

Hi Devin,

Devin Homan <devinwh7@gmail.com> writes:

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

sorry, I made a change earlier that makes this patch non-applicable.
This does not mean I'm against the change you propose, I just
overlooked it.  Don't hesitate to rework the patch and gives this
a bump, if you feel the need.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-16 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-04  1:51 org-timer-set-timer org-notify message and sound arguments Devin Homan
2013-09-16 15:08 ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2013-09-03  7:10 Devin Homan

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).