I'm currently working on a special macro to help me edit LaTeX code. In it the macro identify up to four regions, then ask for user input, and acts upon these regions.
At the time where I ask for user input, I'd like the macro to highlight the four regions, preferably using two different colors (the regions come in two distinct categories) such that the user know what the macro have identified (better safe than sorry)
Any pointers towards good tutorials on how to do this?
See Elisp Manual 38.9 Overlays. For example,
(let ((x (make-overlay start end)))
(overlay-put x 'face '(:background "grey20")))
where the two points start
and end
define the region you wish to highlight.
Another possibility is using text-properties; but that may interfere with font-lock-mode which also uses them, so usually the former is more straightforward.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With