about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-05-28 07:31:53 -0500
committerCase Duckworth2021-05-28 07:31:53 -0500
commitbda5b2538fc037f7e0239cca801452d39360d002 (patch)
tree12766f1bcfe042e1b827baa17f6737f40279a5df /lisp
parentMerge branch 'main' of https://tildegit.org/acdw/emacs (diff)
downloademacs-bda5b2538fc037f7e0239cca801452d39360d002.tar.gz
emacs-bda5b2538fc037f7e0239cca801452d39360d002.zip
Fix mode-line flashing
Thanks, doom-themes!
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