From ef8d5819b3cab677828e2ac21e780c78227acedb Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 5 May 2026 12:23:29 -0500 Subject: refactor!: drop chime-play-sound, use chime-sound-file = nil to disable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `chime-play-sound' was redundant with `chime-sound-file' — both had to be truthy for sound to play, and `chime-sound-file' already documented "set to nil to disable sound completely". Two knobs for one decision is a trap. I removed the defcustom and the `(when chime-play-sound ...)' guard in `chime--notify' (it now just checks `chime-sound-file'). Tests, README quick-start, and the troubleshooting checklist all reference the new single-knob form. One redundant test (sound-disabled-via-the-toggle) got dropped because it now duplicates the sound-file-nil case. Breaking change: users with `(setq chime-play-sound nil)' in their config will get a void-variable warning at customize time and lose their disable. Migration: `(setq chime-sound-file nil)'. --- chime.el | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'chime.el') diff --git a/chime.el b/chime.el index ee08f69..930a067 100644 --- a/chime.el +++ b/chime.el @@ -516,13 +516,6 @@ Result: \"Upcoming Events as of Tue Nov 04 2025 @ 08:25 PM\"" :group 'chime :type 'string) -(defcustom chime-play-sound t - "Whether to play a sound when notifications are displayed. -When non-nil, plays the sound file specified in `chime-sound-file'." - :package-version '(chime . "0.6.0") - :group 'chime - :type 'boolean) - (defcustom chime-sound-file (expand-file-name "sounds/chime.wav" (file-name-directory @@ -1421,8 +1414,8 @@ MSG-SEVERITY is a cons cell (MESSAGE . SEVERITY) where MESSAGE is the notification text and SEVERITY is one of high, medium, or low." (let* ((event-msg (if (consp msg-severity) (car msg-severity) msg-severity)) (severity (if (consp msg-severity) (cdr msg-severity) 'medium))) - ;; Play sound if enabled and sound file is specified - (when (and chime-play-sound chime-sound-file) + ;; Play sound if a file is configured (set chime-sound-file to nil to disable) + (when chime-sound-file (condition-case err (when (file-exists-p chime-sound-file) (play-sound-file chime-sound-file)) -- cgit v1.2.3