emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/tmr 9f0dee563b 06/14: Move tmr-sound.el back into tmr.e


From: ELPA Syncer
Subject: [elpa] externals/tmr 9f0dee563b 06/14: Move tmr-sound.el back into tmr.el
Date: Mon, 27 Jun 2022 12:58:04 -0400 (EDT)

branch: externals/tmr
commit 9f0dee563bbf8d49d7f4599caab4e9dbc80374d5
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Move tmr-sound.el back into tmr.el
---
 tmr-sound.el | 67 ------------------------------------------------------------
 tmr.el       | 23 ++++++++++++++++++++-
 2 files changed, 22 insertions(+), 68 deletions(-)

diff --git a/tmr-sound.el b/tmr-sound.el
deleted file mode 100644
index 0def488653..0000000000
--- a/tmr-sound.el
+++ /dev/null
@@ -1,67 +0,0 @@
-;;; tmr-sound.el --- Play a sound -*- lexical-binding: t -*-
-
-;; Copyright (C) 2020-2022  Free Software Foundation, Inc.
-
-;; Author: Protesilaos Stavrou <info@protesilaos.com>,
-;;         Damien Cassou <damien@cassou.me>
-;; Maintainer: Protesilaos Stavrou <info@protesilaos.com>
-;; URL: https://git.sr.ht/~protesilaos/tmr
-;; Mailing list: https://lists.sr.ht/~protesilaos/tmr
-;; Version: 0.3.1
-;; Package-Requires: ((emacs "27.1"))
-
-;; This file is NOT part of GNU Emacs.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-;;
-;; Provides a function to play a configurable sound file.  This is
-;; useful to get an audio notification when a timer completes.  This
-;; feature requires "ffplay" (part of ffmpeg) to be in the path.
-;;
-;; Choose the sound file through the `tmr-sound-file' option: if its
-;; value is nil or if the file is not found, no sound will be played.
-;;
-;; Please read the manual for all the technicalities.  Either evaluate
-;; (info "(tmr) Top") or visit <https://protesilaos.com/emacs/tmr>.
-
-;;; Code:
-(require 'tmr)
-
-(defcustom tmr-sound-file
-  "/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga"
-  "Path to sound file used by `tmr-sound-play'.
-If nil, don't play any sound."
-  :type '(choice
-          file
-          (const :tag "Off" nil))
-  :group 'tmr)
-
-;; NOTE 2022-04-21: Emacs has a `play-sound' function but it only
-;; supports .wav and .au formats.  Also, it does not work on all
-;; platforms and Emacs needs to be compiled --with-sound capabilities.
-;;;###autoload
-(defun tmr-sound-play (&optional _timer)
-  "Play `tmr-sound-file' using the 'ffplay' executable (ffmpeg).
-TIMER is unused."
-  (when-let ((sound tmr-sound-file)
-             ((file-exists-p sound)))
-    (unless (executable-find "ffplay")
-      (user-error "Cannot play %s without `ffplay'" sound))
-    (call-process-shell-command
-     (format "ffplay -nodisp -autoexit %s >/dev/null 2>&1" sound) nil 0)))
-
-(provide 'tmr-sound)
-;;; tmr-sound.el ends here
diff --git a/tmr.el b/tmr.el
index e12e459eb0..23bd4d60de 100644
--- a/tmr.el
+++ b/tmr.el
@@ -42,6 +42,14 @@
   "TMR May Ring: set timers using a simple notation."
   :group 'data)
 
+(defcustom tmr-sound-file
+  "/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga"
+  "Path to sound file used by `tmr-sound-play'.
+If nil, don't play any sound."
+  :type '(choice
+          file
+          (const :tag "Off" nil)))
+
 (defcustom tmr-timer-created-functions
   (list #'tmr-print-message-for-created-timer)
   "Functions to execute when a timer is created.
@@ -49,7 +57,6 @@ Each function must accept a timer as argument."
   :type 'hook
   :options '(tmr-print-message-for-created-timer))
 
-(declare-function tmr-sound-play "ext:tmr-sound.el" (&optional timer))
 (declare-function tmr-notification-notify "ext:tmr-notification.el" (title 
message))
 
 (defcustom tmr-timer-completed-functions
@@ -239,6 +246,20 @@ completion candidates."
              (selection (completing-read "Timer: " timer-descriptions nil t)))
         (cl-find selection timers :test #'string= :key formatter))))))
 
+;; NOTE 2022-04-21: Emacs has a `play-sound' function but it only
+;; supports .wav and .au formats.  Also, it does not work on all
+;; platforms and Emacs needs to be compiled --with-sound capabilities.
+;;;###autoload
+(defun tmr-sound-play (&optional _timer)
+  "Play `tmr-sound-file' using the 'ffplay' executable (ffmpeg).
+TIMER is unused."
+  (when-let ((sound tmr-sound-file)
+             ((file-exists-p sound)))
+    (unless (executable-find "ffplay")
+      (user-error "Cannot play %s without `ffplay'" sound))
+    (call-process-shell-command
+     (format "ffplay -nodisp -autoexit %s >/dev/null 2>&1" sound) nil 0)))
+
 (defun tmr-print-message-for-created-timer (timer)
   "Show a `message' informing the user that TIMER was created."
   (message "%s" (tmr--long-description timer)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]