summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-05-28 07:31:53 -0500
committerCase Duckworth2021-05-28 07:31:53 -0500
commitbda5b2538fc037f7e0239cca801452d39360d002 (patch)
tree12766f1bcfe042e1b827baa17f6737f40279a5df
parentMerge branch 'main' of https://tildegit.org/acdw/emacs (diff)
downloademacs-bda5b2538fc037f7e0239cca801452d39360d002.tar.gz
emacs-bda5b2538fc037f7e0239cca801452d39360d002.zip
Fix mode-line flashing
Thanks, doom-themes!
-rw-r--r--init.el13
-rw-r--r--lisp/acdw-bell.el28
2 files changed, 32 insertions, 9 deletions
diff --git a/init.el b/init.el index 7c9d96a..b6e73ba 100644 --- a/init.el +++ b/init.el
@@ -50,14 +50,6 @@
50;; see also: `acdw' and friends. Functions here aren't big enough, or they're 50;; see also: `acdw' and friends. Functions here aren't big enough, or they're
51;; too tightly bound to stuff here, to be placed in `acdw'. 51;; too tightly bound to stuff here, to be placed in `acdw'.
52 52
53;; Flash the mode line
54(defun flash-mode-line ()
55 "Flash the modeline as a bell."
56 (when (acdw/system :home)
57 (beep))
58 (invert-face 'mode-line)
59 (run-with-timer 0.1 nil #'invert-face 'mode-line))
60
61(defvar lispy-modes '(emacs-lisp-mode 53(defvar lispy-modes '(emacs-lisp-mode
62 eval-expression-minibuffer 54 eval-expression-minibuffer
63 ielm-mode 55 ielm-mode
@@ -690,11 +682,14 @@
690 (:global "M-SPC" cycle-spacing)) 682 (:global "M-SPC" cycle-spacing))
691 683
692(setup windows 684(setup windows
685 (require 'acdw-bell)
693 (:option use-dialog-box nil 686 (:option use-dialog-box nil
694 use-file-dialog nil 687 use-file-dialog nil
695 tab-bar-show 1 688 tab-bar-show 1
696 visible-bell nil 689 visible-bell nil
697 ring-bell-function #'flash-mode-line 690 ring-bell-function (lambda ()
691 (acdw-bell/flash-mode-line
692 (acdw/system :home)))
698 recenter-positions '(top middle bottom)) 693 recenter-positions '(top middle bottom))
699 694
700 (tooltip-mode -1) 695 (tooltip-mode -1)
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