On Thu, Apr 10, 2025 at 1:56 PM Elijah Gabe Pérez wrote: > Tags: patch > > This feature flashes the current mode-line face (mode-line-active) once, > this is intended to be used in `ring-bell-function', but it can be used > for other purposes. > > There have been third-party packages that make this, however many of > them diverge either in features or in faces. > > I think Emacs should have had this built-in. > An implementation like the one below protects from erroneously leaving behind remapped faces: (defun my/flash-faces (interval faces &rest specs) (let ((cookies (mapcar (lambda (face) (face-remap-add-relative face specs)) faces))) (unwind-protect (sit-for interval) (mapc #'face-remap-remove-relative cookies)))) (defun my/ring-bell-function () (my/flash-faces my:mode-line-ring-bell-interval ; I use 0.05 my:mode-line-ring-bell-faces ; I use '(internal-border tab-bar mode-line-active mode-line-inactive) :background my:mode-line-ring-bell-backround)) ; I use "Firebrick" (I could have used the foreground from 'error) (setq ring-bell-function (if my:mode-line-ring-bell-interval ; I allow my users to disable this #'my/ring-bell-function nil))