diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-05 12:23:29 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-05 12:23:29 -0500 |
| commit | ef8d5819b3cab677828e2ac21e780c78227acedb (patch) | |
| tree | 96d1cd80fc546b4344ada56828f7afd70fb47a29 /chime.el | |
| parent | 68877f04c2ceb569ae5cd74b8303b84b36ced1c5 (diff) | |
| download | chime-ef8d5819b3cab677828e2ac21e780c78227acedb.tar.gz chime-ef8d5819b3cab677828e2ac21e780c78227acedb.zip | |
refactor!: drop chime-play-sound, use chime-sound-file = nil to disable
`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)'.
Diffstat (limited to 'chime.el')
| -rw-r--r-- | chime.el | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -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)) |
