summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-bell.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/lisp/acdw-bell.el b/lisp/acdw-bell.el new file mode 100644 index 0000000..514be1f --- /dev/null +++ b/lisp/acdw-bell.el
@@ -0,0 +1,28 @@
1;;; acdw-bell.el --- flash mode-line on error -*- lexical-binding: t; -*-
2
3;; cribbed pretty heavily from doom-themes-ext-visual-bell.el ...
4
5(require 'face-remap)
6
7(defface acdw-bell '((t (:inherit mode-line-highlight)))
8 "Face to use for the mode-line when `doom-themes-visual-bell-config' is used."
9 :group 'mode-line)
10
11;;;###autoload
12(defun acdw-bell/flash-mode-line (&optional beep-p)
13 "Blink the mode-line red briefly. Set `ring-bell-function' to this to use it.
14If BEEP-P is non-nil, beep too."
15 (let ((acdw-bell//cookie
16 (face-remap-add-relative 'mode-line 'acdw-bell)))
17 (force-mode-line-update)
18 (when beep-p (beep))
19 (run-with-timer 0.15 nil
20 (lambda (cookie buf)
21 (with-current-buffer buf
22 (face-remap-remove-relative cookie)
23 (force-mode-line-update)))
24 acdw-bell//cookie
25 (current-buffer))))
26
27(provide 'acdw-bell)
28;;; acdw-bell.el ends here