2

I would light to highlight where prettify-symbols-mode has prettified a symbol. For example, if Emacs displays lambda as λ it could be displayed with a gray background, but if a literal λ occurs in the text, the background would remain white.

How can I achieve this?

1

You could add another matcher using the same regexp as prettify-symbols-mode, i.e. something like this:

(font-lock-add-keywords
 nil
 `((,(regexp-opt (mapcar 'car prettify-symbols-alist) t)
    (0 (when (funcall prettify-symbols-compose-predicate
                      (match-beginning 0)
                      (match-end 0)
                      (match-string 0))
         '(:background "grey80"))
       append)))
 'append)

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.