GNU bug report logs -
#77715
[PATCH] Add ring-bell functions for mode line and header line.
Previous Next
Full log
Message #8 received at 77715 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Thu, Apr 10, 2025 at 1:56 PM Elijah Gabe Pérez <eg642616 <at> gmail.com>
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))
[Message part 2 (text/html, inline)]
This bug report was last modified 3 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.