Subject: bug#72636: closed (Re: bug#72636: [PATCH] Modify the pulsation effect of pulse.el)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 24 Aug 2024 08:42:02 +0000

Your bug report

#72636: [PATCH] Modify the pulsation effect of pulse.el

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].

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

Subject: Re: bug#72636: [PATCH] Modify the pulsation effect of pulse.el
From: Eli Zaretskii <[email-masked]>
To: Gautier Ponsinet <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Sat, 24 Aug 2024 11:40:09 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Cc: Protesilaos Stavrou <[email-masked]>, [email-masked]
> From: Gautier Ponsinet <[email-masked]>
> Date: Thu, 15 Aug 2024 09:30:35 +0200
> 
> I wanted to use pulse.el without the pulse effect, that is, I have set
> the variable pulse-iterations to 1, and I was expecting the pulse
> library to simply highlight a region or line for the duration specified
> in the variable pulse-delay with the face pulse-highlight-start-face.
> 
> It works, except that the face used is not pulse-highlight-start-face.
> 
> To reproduce in emacs -Q:
> (require 'pulse)
> (setopt pulse-iterations 1)
> (setopt pulse-delay 5)
> (set-face-background 'pulse-highlight-start-face "#ff0000")
> (pulse-momentary-highlight-one-line)
> 
> Note that the color used by pulse is not pulse-highlight-start-face
> (pure red).
> 
> If I understand correctly, this behavior comes from the function
> pulse-momentary-highlight-overlay. The function
> pulse-momentary-highlight-overlay sets an overlay using the face
> pulse-highlight-face (reseted to pulse-highlight-start-face by default,
> that is, if the argument of pulse-momentary-highlight-overlay is nil),
> the function then immediatly starts the pulsation effect. The list of
> colors for the pulsation effect is generated by the function
> color-gradient, but the documentation of color-gradient says about its
> output: "It does not include the START and STOP color in the resulting
> list". Thus the first visible color is the first color of the list
> returned by color-gradient which is different that the starting face
> (pulse-highlight-start-face by default).
> 
> A simple solution would be to add the starting color
> (pulse-highlight-start-face by default) at the beginning of the list of
> colors used for the pulsation effect in
> pulse-momentary-highlight-overlay. Please find attached to this mail a
> patch for pulse.el which does this modification.

Thanks, I installed this improvement on the master branch, and I'm
therefore closing this bug.

Subject: [PATCH] Modify the pulsation effect of pulse.el
From: Gautier Ponsinet <[email-masked]>
To: [email-masked]
Cc: Protesilaos Stavrou <[email-masked]>, [email-masked]
Date: Thu, 15 Aug 2024 09:30:35 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Hello everyone,

CC: Eric M. Ludlam (author of pulse.el) and Protesilaos Stavrou (author
of pulsar.el).

I wanted to use pulse.el without the pulse effect, that is, I have set
the variable pulse-iterations to 1, and I was expecting the pulse
library to simply highlight a region or line for the duration specified
in the variable pulse-delay with the face pulse-highlight-start-face.

It works, except that the face used is not pulse-highlight-start-face.

To reproduce in emacs -Q:
(require 'pulse)
(setopt pulse-iterations 1)
(setopt pulse-delay 5)
(set-face-background 'pulse-highlight-start-face "#ff0000")
(pulse-momentary-highlight-one-line)

Note that the color used by pulse is not pulse-highlight-start-face
(pure red).

If I understand correctly, this behavior comes from the function
pulse-momentary-highlight-overlay. The function
pulse-momentary-highlight-overlay sets an overlay using the face
pulse-highlight-face (reseted to pulse-highlight-start-face by default,
that is, if the argument of pulse-momentary-highlight-overlay is nil),
the function then immediatly starts the pulsation effect. The list of
colors for the pulsation effect is generated by the function
color-gradient, but the documentation of color-gradient says about its
output: "It does not include the START and STOP color in the resulting
list". Thus the first visible color is the first color of the list
returned by color-gradient which is different that the starting face
(pulse-highlight-start-face by default).

A simple solution would be to add the starting color
(pulse-highlight-start-face by default) at the beginning of the list of
colors used for the pulsation effect in
pulse-momentary-highlight-overlay. Please find attached to this mail a
patch for pulse.el which does this modification.

All the best,
Gautier

------------------------------------------------------------------------
In GNU Emacs 31.0.50 (build 61, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.0, Xaw3d scroll bars) of 2024-08-08 built on
 gautier-laptop
Repository revision: 8b662047074f7413c280c9092d1c39763f8b0e5b
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-m17n-flt --without-gconf
 --with-native-compilation=no --with-xinput2 --with-x-toolkit=lucid
 --without-xft --with-xaw3d --with-sound=no --with-tree-sitter
 --without-gpm --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer -g
 -ffile-prefix-map=/home/gautier/.packages/aur/emacs-git/src=/usr/src/debug/emacs-git
 -flto=auto' 'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed
 -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto''

>From 9def4e3b1536a1eba73adb351954569d396fb164 Mon Sep 17 00:00:00 2001
From: Gautier Ponsinet <[email-masked]>
Date: Thu, 15 Aug 2024 09:17:42 +0200
Subject: [PATCH] Modify the pulsation effect of pulse.el

* lisp/cedet/pulse.el (pulse-momentary-highlight-overlay): Add the start
color to the list of colors used for the pulsation effect.
---
 lisp/cedet/pulse.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el
index d9f6a40865a..53256ba3a81 100644
--- a/lisp/cedet/pulse.el
+++ b/lisp/cedet/pulse.el
@@ -158,7 +158,7 @@ ;;; Convenience Functions
                      (face-background 'pulse-highlight-face nil 'default)))
              (stop (color-name-to-rgb (face-background 'default)))
              (colors (mapcar (apply-partially 'apply 'color-rgb-to-hex)
-                             (color-gradient start stop pulse-iterations))))
+                             (cons start (color-gradient start stop (1- pulse-iterations))))))
         (setq pulse-momentary-timer
               (run-with-timer 0 pulse-delay #'pulse-tick
                               colors
-- 
2.46.0