35

Those sounds all the way drive me crazy, but it is uncomfortable to switch off system sounds at all because I need them in other places same time. I didn't find any settings where I could manage the sounds.

3
  • 13
    I assume you mean the annoying bell sound in emacs. If that's the case, you can disable it by adding this in your .emacs : (setq ring-bell-function 'ignore) Nov 25, 2016 at 21:01
  • @ChakravarthyRaghunandan sorry, but I didn't find this file, could you give a hint? Nov 26, 2016 at 14:45
  • o my god YES, I found it because I forgot to setup the folder for search and it searched through all the disks. It helped, thanx a lot! Nov 26, 2016 at 15:54

3 Answers 3

34

Turn off the bell, use the visual bell instead, or replace bell-ringing by some other visual indication.

You can set ring-bell-function to a function such as ignore, to just turn off all indication.

Or you can customize option visible-bell, to use a frame flash instead of a sound.

Or you can use minor mode echo-bell-mode from library echo-bell.el to get just a brief visual indication in the echo area.

See also the Elisp manual, node Beeping.

9
  • 3
    but where to do it? I do not see any hint nor here neither by the link, I'm missing some base knowledge everybody knows Nov 26, 2016 at 15:06
  • 2
    You can put variable settings in your init file (and see Find Init), and you can turn on a minor mode there. The Emacs manual (C-h r) is your friend. A little time spent there can really help you wrt base knowledge, and a lifetime spent there can be a great pastime. ;-)
    – Drew
    Nov 26, 2016 at 15:32
  • I try to follow the instructions in @find file@, but I have no HOME enviroment vaiable (what makes sence, I have never set up HOME), and I also can't find init file by it's name by total commande's "find". Could it have a name like "ediff-init.el" or "viper-init.el"? Nov 26, 2016 at 15:39
  • 10
    @AnnaLeonenko just put the following lines in your ~/.emacs file: (setq visible-bell t) and (setq ring-bell-function 'ignore). You will also need to restart your emacs or eval the file.
    – rph
    Nov 5, 2018 at 2:29
  • 1
    I usually set things up with customize. I.e. you do 'M-x describe-variable ENTER ring-bell-function` then you can go to a menu where you can select silent. Dec 9, 2019 at 17:36
2

If you compile Emacs yourself, and you don't want it to be capable of producing sound in general, then you can use:

./configure --without-sound
1

Instead of turning off sound, you can use a visible-bell,

this function temporarily inverts the mode-line/header-line

(defun my-mode-line-visual-bell ()
  (setq visible-bell nil)
  (setq ring-bell-function 'my-mode-line-visual-bell--flash))

(defun my-mode-line-visual-bell--flash ()
  (let ((frame (selected-frame)))
    (run-with-timer
     0.1 nil
     #'(lambda (frame)
         (let ((inhibit-quit)
               (inhibit-redisplay t))
           (invert-face 'header-line frame)
           (invert-face 'header-line-highlight frame)
           (invert-face 'mode-line frame)
           (invert-face 'mode-line-inactive frame)))
     frame)
    (let ((inhibit-quit)
          (inhibit-redisplay t))
      (invert-face 'header-line frame)
      (invert-face 'header-line-highlight frame)
      (invert-face 'mode-line frame)
      (invert-face 'mode-line-inactive frame))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.