views:

968

answers:

3

I've been looking into adopting Carbon Emacs for use on my Mac, and the only stumbling block I've run into is the annoying scroll beep when you try to scroll past the end of the document. I've looked online but I can't seem to find what I should add to my .emacs that will stop it from beeping when scrolling. I don't want to silence it completely, just when scrolling. Any ideas?

+2  A: 

You will have to customize the ring-bell-function.

This page may provide hints:

http://www.emacswiki.org/emacs/AlarmBell

Svante
Alas, that won't work. For example, the next-line function has a "ding" hard-coded into it.
ShreevatsaR
Hmm. Couldn't you just redefine the next-line function in your .emacs then?
Svante
You'll have to redefine not just next-line and previous-line, but also scroll-up, scroll-down, and a whole lot of functions; many of which are defined in "C source code" and whose source does not ship with Carbon Emacs. Someone correct me if I'm wrong.
ShreevatsaR
+3  A: 
(setq visible-bell t)

This makes emacs flash instead of beep.

wunki
True, but this will silence everything, which the OP wanted to avoid.This is what I use though - the visual bell is just as helpful as an audible one, and doesn't interfere with music when I'm using headphones. I'd recommend it to 'nobody' anyway.
jmanning2k
+4  A: 

Using the hints from the Emacs wiki AlarmBell page, this does it for me:

(defun my-bell-function ()
  (unless (memq this-command
     '(isearch-abort abort-recursive-edit exit-minibuffer
              keyboard-quit mwheel-scroll down up next-line previous-line
              backward-char forward-char))
    (ding)))
(setq ring-bell-function 'my-bell-function)

If you don't know the name of a command, press C-h k then the key/action you would like to get the name of.

nominolo