themes icon indicating copy to clipboard operation
themes copied to clipboard

Visual bell doesn't work with solaire-mode

Open seagle0128 opened this issue 2 years ago • 4 comments

Theme(s)

All themes (base)

What were you expecting?

visual bell should work with solaire-mode.

What actually happened?

visual bell doesn't work if solaire-mode is enabled in the buffer.

Steps to reproduce

  1. Load one of doom themes.
  2. Eval doom-themes-visual-bell-config.
  3. Press C-g. Visual bell (red flashing) appears.
  4. Enable solaire-mode.
  5. Press C-g. Nothing happens in the mode-line.

Operating system

All

Emacs version

29

Installed commit of doom-themes

20220619.2105

seagle0128 avatar Jun 20 '22 13:06 seagle0128

I can confirm it only occurs on 29. I found these comments

;; Since emacs 29, the mode-line face is the parent of the new face ;; mode-line-active and mode-line-inactive. For remapping purposes, the ;; mode-line-active face has to be used, see details at: ;; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=53636

Not sure whether it's an issue of doom-themes or solaire-mode.

seagle0128 avatar Jun 25 '22 18:06 seagle0128

My workaround:

(defun doom-themes-visual-bell-fn ()
  "Blink the mode-line red briefly. Set `ring-bell-function' to this to use it."
  (let* ((buf (current-buffer))
         (cookies `(,(face-remap-add-relative 'mode-line-active
                                              'doom-themes-visual-bell)
                    ,(face-remap-add-relative 'mode-line
                                              'doom-themes-visual-bell))))
    (force-mode-line-update)
    (run-with-timer 0.15 nil
                    (lambda ()
                      (with-current-buffer buf
                        (mapc #'face-remap-remove-relative cookies)
                        (force-mode-line-update))))))

seagle0128 avatar Jul 06 '22 16:07 seagle0128

ping kindly...

seagle0128 avatar Aug 08 '23 14:08 seagle0128

Update the workaround:

   (defun my-doom-themes-visual-bell-fn ()
            "Blink the mode-line red briefly. Set `ring-bell-function' to this to use it."
            (let ((buf (current-buffer))
                  (cookies (mapcar (lambda (face)
                                     (face-remap-add-relative face 'doom-themes-visual-bell))
                                   (if (facep 'mode-line-active)
                                       '(mode-line-active solaire-mode-line-active-face)
                                     '(mode-line solaire-mode-line-face)))))
              (force-mode-line-update)
              (run-with-timer 0.15 nil
                              (lambda ()
                                (with-current-buffer buf
                                  (mapc #'face-remap-remove-relative cookies)
                                  (force-mode-line-update))))))
          (advice-add #'doom-themes-visual-bell-fn :override #'my-doom-themes-visual-bell-fn)

seagle0128 avatar Dec 21 '23 12:12 seagle0128