11

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?

17 of 26
  • 27,121
  • 13
  • 66
  • 85
Kyle Cronin
  • 77,653
  • 43
  • 148
  • 164

5 Answers5

9
(setq visible-bell t)

This makes emacs flash instead of beep.

wunki
  • 653
  • 6
  • 13
  • 2
    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 Dec 08 '08 at 22:00
7

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
  • 5,085
  • 2
  • 25
  • 31
3

Between Stephen Hassard's answer and Kipton Barros' comment:

(setq ring-bell-function 'ignore)

seems to be the most concise, works on emacs 24.x, and answers the original question.

3

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

This page may provide hints:

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

Svante
  • 50,694
  • 11
  • 78
  • 122
  • Alas, that won't work. For example, the next-line function has a "ding" hard-coded into it. – ShreevatsaR Nov 27 '08 at 19:30
  • Hmm. Couldn't you just redefine the next-line function in your .emacs then? – Svante Nov 28 '08 at 01:27
  • 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 Nov 28 '08 at 07:18
0

This seems to do the trick:

(setq ring-bell-function nil)