From bda5b2538fc037f7e0239cca801452d39360d002 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 28 May 2021 07:31:53 -0500 Subject: Fix mode-line flashing Thanks, doom-themes! --- lisp/acdw-bell.el | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lisp/acdw-bell.el (limited to 'lisp') 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 @@ +;;; acdw-bell.el --- flash mode-line on error -*- lexical-binding: t; -*- + +;; cribbed pretty heavily from doom-themes-ext-visual-bell.el ... + +(require 'face-remap) + +(defface acdw-bell '((t (:inherit mode-line-highlight))) + "Face to use for the mode-line when `doom-themes-visual-bell-config' is used." + :group 'mode-line) + +;;;###autoload +(defun acdw-bell/flash-mode-line (&optional beep-p) + "Blink the mode-line red briefly. Set `ring-bell-function' to this to use it. +If BEEP-P is non-nil, beep too." + (let ((acdw-bell//cookie + (face-remap-add-relative 'mode-line 'acdw-bell))) + (force-mode-line-update) + (when beep-p (beep)) + (run-with-timer 0.15 nil + (lambda (cookie buf) + (with-current-buffer buf + (face-remap-remove-relative cookie) + (force-mode-line-update))) + acdw-bell//cookie + (current-buffer)))) + +(provide 'acdw-bell) +;;; acdw-bell.el ends here -- cgit 1.4.1-21-gabe81