When reading a book it's nice to have a marker to highlight some phrases.

When re-reading my own code, I often would like to highlight several regions ("here is the set-up", "here is the conclusion", ...). In a normal programming language one can write the code such that these divisions are themselves the structure of the code, but it's trickier with HTML. There one is left with just transient-mark-mode (and even then, there is no way to edit a file while the transient mark is active in a distinct segment of the buffer).

Does there exist a package that permits adding temporary markers (light yellow, light green, ...) to an arbitrary file. I'm familiar with Hi-Lock and ideas for how to use it for this objective in an arbitrary file are welcome.

1 Answer 1

  1. I think you're asking about ad hoc, non-persistent highlighting.

    If so, library highlighting.el offers what you're looking for. (The highlighting can also be persistent, but typically it is not).

    There are many ways to use it to highlight arbitrary parts of your text or code, in any number of faces. And you can apply the highlighting using any of those different ways either as an overlay or using a text property.

  2. Also, if you use library Bookmark+ then you can set Emacs bookmarks and have them automatically highlight the target locations in various ways. And the bookmarks can be persistent or temporary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.