Rudy’s OBTF Rudolf Adamkovič

Home / Emacs / Bell


Unit-testing

ding does not work in batch mode,

emacs --batch --eval \
'(let ((ring-bell-function (lambda () (print "ding")))) (ding))'


but it could be tested with cl-letf,

(require 'ert)
(should-error
 (progn (define-error 'ding "Ring my bell!")
        (cl-letf (((symbol-function 'ding)
                   (lambda () (signal 'ding nil))))
          (ding)))
 :type 'ding)
(ding)

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.