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.

  • 8
    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) – Chakravarthy Raghunandan Nov 25 '16 at 21:01
  • @ChakravarthyRaghunandan sorry, but I didn't find this file, could you give a hint? – Anna Leonenko Nov 26 '16 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! – Anna Leonenko Nov 26 '16 at 15:54

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.

  • 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 – Anna Leonenko Nov 26 '16 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 '16 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"? – Anna Leonenko Nov 26 '16 at 15:39
  • 7
    @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 '18 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. – Christian Herenz Dec 9 '19 at 17:36

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

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)))
     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)))
    (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, privacy policy and cookie policy

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