all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gabriel <gabriel376@hotmail.com>
To: emacs-devel@gnu.org
Subject: Re: Little improvements on pulse.el
Date: Thu, 11 Mar 2021 20:42:40 -0300	[thread overview]
Message-ID: <CH2PR01MB5879228BEAE8309D08E658C48B909@CH2PR01MB5879.prod.exchangelabs.com> (raw)
In-Reply-To: <83ft13p5ow.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 10 Mar 2021 14:13:35 +0200")


>> 3. I could not find any documentation or usage in emacs source code for
>> 'pulse-line-hook-function' and 'pulse-command-advice-flag'. Is the flag
>> 'pulse-command-advice-flag' really needed ? The git history says the
>> last modification of this code was 12+ years ago.
>
> You will find one usage of the hook in CEDET.  In any case, after so
> many years I don't think we should consider removing these without a
> good reason.  Is there such a reason?

The only reason to remove it was because I thought it was not being
used anywhere. If it's used by CEDET, we can keep as it is.

>> 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()






  parent reply	other threads:[~2021-03-11 23:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10  5:39 Little improvements on pulse.el Gabriel
2021-03-10 12:13 ` Eli Zaretskii
2021-03-10 13:41   ` Stefan Kangas
2021-03-10 17:18     ` Juri Linkov
2021-03-10 18:51       ` Juri Linkov
2021-03-10 19:11         ` Eli Zaretskii
2021-03-11 23:42   ` Gabriel [this message]
2021-03-12  7:29     ` Eli Zaretskii
2021-03-10 18:59 ` Juri Linkov
2021-03-11 15:35 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH2PR01MB5879228BEAE8309D08E658C48B909@CH2PR01MB5879.prod.exchangelabs.com \
    --to=gabriel376@hotmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.