You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

doom-themes-ext-visual-bell.el 1.1KB

1234567891011121314151617181920212223242526272829
  1. ;;; doom-themes-ext-visual-bell.el --- flash mode-line on error -*- lexical-binding: t; -*-
  2. (require 'face-remap)
  3. (defface doom-visual-bell '((t (:inherit error)))
  4. "Face to use for the mode-line when `doom-themes-visual-bell-config' is used."
  5. :group 'doom-themes)
  6. ;;;###autoload
  7. (defun doom-themes-visual-bell-fn ()
  8. "Blink the mode-line red briefly. Set `ring-bell-function' to this to use it."
  9. (let ((doom-themes--bell-cookie (face-remap-add-relative 'mode-line 'doom-visual-bell)))
  10. (force-mode-line-update)
  11. (run-with-timer 0.15 nil
  12. (lambda (cookie buf)
  13. (with-current-buffer buf
  14. (face-remap-remove-relative cookie)
  15. (force-mode-line-update)))
  16. doom-themes--bell-cookie
  17. (current-buffer))))
  18. ;;;###autoload
  19. (defun doom-themes-visual-bell-config ()
  20. "Enable flashing the mode-line on error."
  21. (setq ring-bell-function #'doom-themes-visual-bell-fn
  22. visible-bell t))
  23. (provide 'doom-themes-ext-visual-bell)
  24. ;;; doom-themes-ext-visual-bell.el ends here