Created
April 29, 2022 18:37
-
-
Save ashton314/4ca20e6e040f07aef58a05f42d018e23 to your computer and use it in GitHub Desktop.
Play a sound after every keypress in Emacs on macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Resource: https://stackoverflow.com/questions/11206140/typewriter-sounds-for-emacs | |
(defvar tink "/System/Library/Sounds/Tink.aiff") | |
(defun play (file) | |
(let ((buf (get-buffer-create "playnoise"))) | |
(start-process-shell-command "play" buf (concat "afplay " file)))) | |
(defun do-tink () | |
(play tink)) | |
(add-hook 'post-command-hook 'do-tink) | |
; if you're about to die, run | |
; (remove-hook 'post-command-hook 'do-tink) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment