emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Little improvements on pulse.el


From: Eli Zaretskii
Subject: Re: Little improvements on pulse.el
Date: Fri, 12 Mar 2021 09:29:36 +0200

> From: Gabriel <gabriel376@hotmail.com>
> Date: Thu, 11 Mar 2021 20:42:40 -0300
> 
> >> 5. The code on 'pulse-lighten-highlight' can be significantly improved
> >> by replacing 'pulse-int-to-hex' and 'pulse-color-values-to-hex' with
> >> 'color-gradient' from color.el. The idea is to build the list of color
> >> gradients beforehand and use a timer to set each color according to
> >> 'pulse-iterations' and 'pulse-delay'. A very basic example:
> >
> > I'm not sure I understand the improvement, can you elaborate?
> 
> I will try to briefly explain how it works and how it could be
> improved. The main function ('pulse-momentary-highlight-overlay') runs
> 'pulse-tick' with a timer, passing a stop-time as parameter. The
> 'pulse-tick' calls 'pulse-lighten-highlight' that has a complex logic to
> calculate the next color for the pulse overlay. It basically checks for
> the current iteration number and calculates the appropriate RGB (a
> little bit lighter than the previous one), using a helper function in
> the same file ('pulse-color-values-to-hex'). All this code can be
> replaced by 'color-gradient' from 'color.el' that, according to Stefan
> Monnier in another thread, was added to Emacs after pulse.el. The
> pseudo-code is:
> 
> for each color in color-gradients(start, stop, length):
>     update-overlay(color)
>     sleep()

OK, so the timer thing is still needed, right?  color-gradients only
replace the calculation of the next color.  SGTM, thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]