Emacs has this habit of beeping when something goes wrong (or when the user presses C-g
). Frankly, this is quite useful, since it is an instant feedback, but there are times when I don’t want that behavior. There are a few solutions then. One of them is just to put your headphones on (and I sometimes do it indeed). But this is Emacs, so there is (as always) a software solution. It turns out that not only can you disable beeping, you can change it into all sorts of things. One of them is to change an audible signal to a visible one. Interestingly, there is no command for this, only a variable. You can say M-x set-variable RET visible-bell RET t RET
and now Emacs flashes (parts of) the screen instead of beeping. You can also set the variable ring-bell-function
to a function, and then Emacs will call that function instead of beeping – this way you can e.g. lanch a process to play a file with your favorite sound each time you press C-g
! Some other possibilities are mentioned in the Emacs wiki page about the bell.
Finally, if you want your Elisp code to beep, the function ding
does that. And that’s it for today – happy beeping!