7

When font-lock-mode is enabled I cannot get custom faces to stick with add-text-properties or set-text-properties. I've looked through libraries like hi-lock.el, but they all seem to be regexp based. I want to highlight by points; (point) to (point-max) for example.

How can I highlight text (similar to hi-lock) by regions?

Drew
  • 75,699
  • 9
  • 109
  • 225
user8523
  • 73
  • 2

1 Answers1

3

First, you can get highlighting to "stick" by using property font-lock-face instead of property face.

Second, you can do what you want (using either property) with library highlight.el.

You can use command hlt-highlight to highlight or unhighlight the region, or to highlight or unhighlight a regexp throughout the region, depending on the prefix argument. It combines the behaviors of commands hlt-highlight-region, hlt-unhighlight-region, hlt-highlight-regexp-region, and hlt-highlight-regexp-region.

Drew
  • 75,699
  • 9
  • 109
  • 225