Subject: bug#77715: closed (Re: bug#77715: [PATCH] Add ring-bell functions for mode line and header line.)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 17 May 2025 08:59:02 +0000

Your bug report

#77715: [PATCH] Add ring-bell functions for mode line and header line.

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
77715: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77715
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#77715: [PATCH] Add ring-bell functions for mode line and header line.
From: Eli Zaretskii <[email-masked]>
To: Elijah Gabe Pérez <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Sat, 17 May 2025 11:58:41 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Elijah Gabe Pérez <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Sat, 10 May 2025 18:39:57 -0600
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> From: Elijah Gabe Pérez <[email-masked]>
> >> Cc: [email-masked],  [email-masked],  [email-masked]
> >> Date: Tue, 29 Apr 2025 18:07:06 -0600
> >
> > Thanks, a few comments related to English grammar and wording in the
> > documentation part of this patch:
> >
> >> +---
> >> +*** New function 'flash-face-bell-function'.
> >> +This function flash a face briefly.
> >                  ^^^^^
> [...]
> 
> Thanks, I've updated the patch.

Thanks, now installed on the master branch, and closing the bug.

Subject: [PATCH] Add ring-bell functions for mode line and header line.
From: Elijah Gabe Pérez <[email-masked]>
To: [email-masked]
Date: Thu, 10 Apr 2025 11:55:20 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

>From e17ea82e1476dd14c3502caa966332453c5513f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <[email-masked]>
Date: Thu, 10 Apr 2025 11:38:21 -0600
Subject: [PATCH] Add ring-bell functions for flash mode line or header line.

New functions for flash the mode line or header line once
whether `ring-bell-function' is called.  (bug#)

* lisp/faces.el (mode-line-flash, header-line-flash): New faces.
* lisp/simple.el (mode-line-ring-bell-delay)
(header-line-ring-bell-delay): New user options.
(mode-line-ring-bell--reset-face, mode-line-ring-bell)
(header-line-ring-bell--reset-face, header-line-ring-bell): New
functions.
---
 lisp/faces.el  | 21 +++++++++++++++++++++
 lisp/simple.el | 30 ++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/lisp/faces.el b/lisp/faces.el
index dbc0a2e04f6..b1d84c3dac0 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2745,6 +2745,27 @@ mode-line-inactive
   :group 'mode-line-faces
   :group 'basic-faces)
 
+(defface mode-line-flash
+  '((((class color) (min-colors 88))
+     :box (:line-width -1 :color "brown" :style nil)
+     :background "red3" :foreground "white")
+    (((class color grayscale) (min-colors 88))
+     :box (:line-width -1 :style nil)
+     :background "grey10" :foreground "white")
+    (t
+     :inherit error :inverse-video t))
+  "Basic mode line face for flash it."
+  :version "31.1"
+  :group 'mode-line-faces
+  :group 'basic-faces)
+
+(defface header-line-flash
+  '((t :inherit mode-line-flash))
+  "Basic header line face for flash it."
+  :version "31.1"
+  :group 'mode-line-faces
+  :group 'basic-faces)
+
 (defface mode-line-highlight
   '((((supports :box t) (class color grayscale) (min-colors 88))
      :box (:line-width 2 :color "grey40" :style released-button))
diff --git a/lisp/simple.el b/lisp/simple.el
index 7037158df8d..ee995c35699 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -9383,6 +9383,36 @@ auto-save-mode
   (and (< buffer-saved-size 0)
        (setq buffer-saved-size 0)))
 
+(defcustom mode-line-ring-bell-delay 0.05
+  "Delay used by `mode-line-ring-bell'."
+  :type 'float
+  :version "31.1")
+
+(defun mode-line-ring-bell--reset-face ()
+  (face-remap-reset-base 'mode-line-active))
+
+(defun mode-line-ring-bell ()
+  "Flash the mode line as ring a bell.
+Intended to be used in `ring-bell-function'."
+  (face-remap-set-base 'mode-line-active 'mode-line-flash)
+  (run-with-timer mode-line-ring-bell-delay nil
+                  #'mode-line-ring-bell--reset-face))
+
+(defcustom header-line-ring-bell-delay 0.05
+  "Delay used by `header-line-ring-bell'."
+  :type 'float
+  :version "31.1")
+
+(defun header-line-ring-bell--reset-face ()
+  (face-remap-reset-base 'header-line-active))
+
+(defun header-line-ring-bell ()
+  "Flash the header line as ring a bell.
+Intended to be used in `ring-bell-function'."
+  (face-remap-set-base 'header-line-active 'header-line-flash)
+  (run-with-timer header-line-ring-bell-delay nil
+                  #'header-line-ring-bell--reset-face))
+
 (defgroup paren-blinking nil
   "Blinking matching of parens and expressions."
   :prefix "blink-matching-"
-- 
2.49.0

-- 
                                          - E.G via GNU Emacs and Org.