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?

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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