0

I heard about pulse.el recently on r/emacs and thought of using it to highlight the chunks of text inserted, removed or changed on undoing and redoing edits, just like evil-goggles used to do:

enter image description here
There's another neat thing that evil-goggles used to do, using different colors for different type of changes (insert, delete or edit).

My problem is that while pulse.el has a function that looks like it could be used to this end, pulse-momentary-highlight-region, I don't know how to find the two arguments it requires, which are the points where the chunk of text involved in the undo/redo begins and ends.

8
  • Having previously written a fork of the undo-tree library, I am somewhat familiar with that original library. Inasmuch as your question does not specifically relate to undo-tree, however, I am hesitant to do more at this time besides leave a comment.... Does your question relate to undo-tree only, or does it relate to the default built-in undo/redo feature, or does it relate to something called evil-goggles? Or, perhaps, do you believe that one solution will fit all -- i.e., a one size fits all approach? What version of Emacs are you using?
    – lawlist
    Nov 21 '20 at 19:04
  • Here is a link to a recent thread on reddit that seems somewhat similar: reddit.com/r/emacs/comments/jxlsms/…
    – lawlist
    Nov 21 '20 at 19:22
  • Hello @lawlist, I use undo-tree and an undo-tree-specific solution would be just as good. To be honest, I was hoping in a more versatile solution because I want to apply it to keyboard macros as well, but I can see about that separately. I'm using GNU Emacs 26.3 but I'm going to upgrade to v27 in a couple of days. Nov 21 '20 at 21:48
  • My first guess at an approach would be to type M-x find-function RET primitive-undo RET, and copy that function over to a *scratch* buffer. Then look at the sections of code (insert string) that appear in a couple of locations. That looks like a potential entry point to apply the overlays to the applicable string. However, I haven't tested any of that ... This approach will probably suffice for both the default built-in Emacs 26 and/or 27, as well as the stock version of undo-tree. That being said, I am still a little reluctant to open a Pandora's Box by writing up an answer ...
    – lawlist
    Nov 21 '20 at 22:16
  • You will need to make decisions regarding how to handle text that has been removed as you really cannot highlight something that is not there any more ...
    – lawlist
    Nov 21 '20 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.