all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#72636: [PATCH] Modify the pulsation effect of pulse.el
@ 2024-08-15  7:30 Gautier Ponsinet
  2024-08-24  8:40 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Gautier Ponsinet @ 2024-08-15  7:30 UTC (permalink / raw)
  To: 72636; +Cc: Protesilaos Stavrou, zappo

[-- Attachment #1: Type: text/plain, Size: 3112 bytes --]

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''


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Modify-the-pulsation-effect-of-pulse.el.patch --]
[-- Type: text/patch, Size: 1160 bytes --]

From 9def4e3b1536a1eba73adb351954569d396fb164 Mon Sep 17 00:00:00 2001
From: Gautier Ponsinet <gautier@gautierponsinet.xyz>
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#72636: [PATCH] Modify the pulsation effect of pulse.el
  2024-08-15  7:30 bug#72636: [PATCH] Modify the pulsation effect of pulse.el Gautier Ponsinet
@ 2024-08-24  8:40 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2024-08-24  8:40 UTC (permalink / raw)
  To: Gautier Ponsinet; +Cc: 72636-done, zappo, public

> Cc: Protesilaos Stavrou <public@protesilaos.com>, zappo@gnu.org
> From: Gautier Ponsinet <gautier@gautierponsinet.xyz>
> 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.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-24  8:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15  7:30 bug#72636: [PATCH] Modify the pulsation effect of pulse.el Gautier Ponsinet
2024-08-24  8:40 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.