forked from doomemacs/themes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doom-themes-ext-visual-bell.el
29 lines (24 loc) · 1.09 KB
/
doom-themes-ext-visual-bell.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
;;; doom-themes-ext-visual-bell.el --- flash mode-line on error -*- lexical-binding: t; -*-
(require 'face-remap)
(defface doom-visual-bell '((t (:inherit error :inverse-video t)))
"Face to use for the mode-line when `doom-themes-visual-bell-config' is used."
:group 'doom-themes)
;;;###autoload
(defun doom-themes-visual-bell-fn ()
"Blink the mode-line red briefly. Set `ring-bell-function' to this to use it."
(let ((doom-themes--bell-cookie (face-remap-add-relative 'mode-line 'doom-visual-bell)))
(force-mode-line-update)
(run-with-timer 0.15 nil
(lambda (cookie buf)
(with-current-buffer buf
(face-remap-remove-relative cookie)
(force-mode-line-update)))
doom-themes--bell-cookie
(current-buffer))))
;;;###autoload
(defun doom-themes-visual-bell-config ()
"Enable flashing the mode-line on error."
(setq ring-bell-function #'doom-themes-visual-bell-fn
visible-bell t))
(provide 'doom-themes-ext-visual-bell)
;;; doom-themes-ext-visual-bell.el ends here