Browse Source

Expand file name in org-clock-sound before using it

Carsten Dominik 15 years ago
parent
commit
5b65dc2bdf
2 changed files with 11 additions and 7 deletions
  1. 3 0
      lisp/ChangeLog
  2. 8 7
      lisp/org-clock.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-11-02  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-clock.el (org-clock-play-sound): Expand file in
+	org-clock-sound, to allow ~ for home.
+
 	* org-remember.el (org-remember-handler): Set
 	text-before-node-creation even if this already looks like a node,
 	because the string might be needed on non-org-mode target files.

+ 8 - 7
lisp/org-clock.el

@@ -500,13 +500,14 @@ Use alsa's aplay tool if available."
    ((not org-clock-sound))
    ((eq org-clock-sound t) (beep t) (beep t))
    ((stringp org-clock-sound)
-    (if (file-exists-p org-clock-sound)
-	(if (org-program-exists "aplay")
-	    (start-process "org-clock-play-notification" nil
-			   "aplay" org-clock-sound)
-	  (condition-case nil
-	      (play-sound-file org-clock-sound)
-	    (error (beep t) (beep t))))))))
+    (let ((file (expand-file-name org-clock-sound)))
+      (if (file-exists-p file)
+	  (if (org-program-exists "aplay")
+	      (start-process "org-clock-play-notification" nil
+			     "aplay" file)
+	    (condition-case nil
+		(play-sound-file file)
+	      (error (beep t) (beep t)))))))))
 
 (defun org-program-exists (program-name)
   "Checks whenever we can locate program and launch it."