phikal / undo-hl

Highlight undo operations so you never get lost

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undo-hl

Sometimes in a long undo chain where Emacs jumps to a far away position, I can’t tell whether the undo operation just moved to this position or it has also deleted some text. This package is meant to alleviate that confusion: it flashes the to-be-deleted text before deleting so I know what is happening.

This package is pretty efficient, I can hold down undo button and the highlight doesn’t slow down the operation.

Watch demo on YouTube or download local copy of demo.

This is different from highlight-changes-mode in several regards. It highlights to-be-deleted text before deleting rather than after. Marking the deleted text after it’s deleted isn’t very helpful in my situation. It also has less functionalities than highlight-changes-mode, but I’m quite happy with the single function it now has.

Usage

Download the package and M-x undo-hl-mode RET. This is a local minor mode so you need to add to other mode’s hooks. I recommend only enabling this for text-editing modes.

Customization

  • Face: undo-hl-delete
  • Face: undo-hl-insert
  • Option: undo-hl-undo-commands. Undo-hl only runs before and after undo commands, if you use non-default undo commands, add them to this list.
  • Option: undo-hl-flash-duration. “Undo-hl flashes the to-be-deleted text for this number of seconds. Note that insertion highlight is not affected by this option: the highlight is removed when next command is called, not after a timer.

About

Highlight undo operations so you never get lost


Languages

Language:Emacs Lisp 100.0%