reddit / emacs

Help with advice-add

Err000r__1010 · 2022-08-23 14:34
I'm using `org-alert` to get notifications from my agenda. The alerts are working but I wanted to add sound to them. So I added an advice which triggers a shell command to play a sound when `org-alert` sends a notification. (advice-add 'alert :after #'my/play-sound-on-alert '((name . "my/org-alert-sound"))) (defun my/play-sound-on-alert () (start-process-shell-command "Agenda Alert" nil "afplay /System/Library/Sounds/Blow.aiff")) Whenever the notifications pops-up I get an error saying: Wrong number of arguments: (lambda nil (start-process-shell-command "Agenda Alert" nil "afplay /System/Library/Sounds/Blow.aiff")), 1 I don't know what I'm missing. Thanks!
BunnyLushington · 2022-08-23 15:25
Try `(defun my/play-sound-on-alert (&rest r) ...)` (Edit: s/define/defun/; damn autocorrect...)
LordOfSwines · 2022-08-23 15:25
`(defun my/play-sound-on-alert (&rest r)` See: `C-h add-function`
Bodertz · 2022-08-24 02:27
`defun` rather than `define`.
Err000r__1010 · 2022-08-24 03:02
wow, it works! Thanks a lot!
Err000r__1010 · 2022-08-24 03:02
it works! thanks a ton
BunnyLushington · 2022-08-24 16:36
Duh. Nice catch.