M-x all-things-emacs

Quick Tip: visible-bell

February 6th, 2007 by Ryan McGeary · 116 Comments

This one is personal preference, but I find it annoying when emacs beeps on errors. I like knowing when something bad/unexpected happened, but the beep is too much when the sound is on and useless when muted. Add this to your .emacs to enable a visual alert cue that flashes the frame instead:

(setq visible-bell t)

Note: From what I can tell, this only works under a windowing system, so it won’t do much good if you run emacs in terminal mode.

Tags: quick · tips

116 responses so far ↓

  • 1 Todd Larason // Feb 6, 2007 at 7:02 am

    For reasons I still haven’t figured out, my X server locks up when emacs beeps, so it’s vital that emacs really doesn’t ever beep. Setting visible-bell doesn’t work well enough — it seems to get turned off under some circumstances (I haven’t figured that out yet, either).

    So, I’ve been using:

    (setq ring-bell-function (lambda () (message "*beep*")))

    that isn’t great, since I can miss beeps, but it works reliably. It would be nice if the visible-bell functionality were exposed more directly, but as far as I can tell it’s not, and I haven’t come up with an elisp version I’m happy with.

  • 2 Jason // Feb 8, 2007 at 1:53 pm

    For a visible bell in terminal mode, you can run emacs under screen, and tell screen to make the normal bell visible; this works for all your terminal programs, not just emacs.

  • 3 kmmbvnr // Mar 2, 2007 at 5:09 am

    Some alerts are useful in any case. You are not obliged to disable all of them.

    ;; Emacs does not beep or flash anymore, 
    ;; on hit C-g in the minibuffer or during 
    ;; an isearch.
    (setq ring-bell-function 
          (lambda ()
            (unless (memq this-command
                          '(isearch-abort abort-recursive-edit