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:
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.
undo-tree
library, I am somewhat familiar with that original library. Inasmuch as your question does not specifically relate toundo-tree
, however, I am hesitant to do more at this time besides leave a comment.... Does your question relate toundo-tree
only, or does it relate to the default built-in undo/redo feature, or does it relate to something calledevil-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?undo-tree
and anundo-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.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 ofundo-tree
. That being said, I am still a little reluctant to open a Pandora's Box by writing up an answer ...