emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help with Fontification


From: Reza Nikoopour
Subject: Help with Fontification
Date: Tue, 2 Nov 2021 21:00:40 -0700

Hello All,

I'm working on refactoring terraform mode and I've stumbled across
a fontification issue I cannot figure out how to solve.  

image.png

A resource can be broken down into the three parts:
The keyword "resource", the resource type (green in the image), and the resource
name (pink in the image).

The resource name and type are string literals so I
used the override flag for the regex when setting font-lock-defaults:
(defvar terraform-font-lock-keywords
  ;; other code
  (,terraform--block-builtins-with-type-and-name--type-highlight-regexp 2 'terraform--resource-type t)
  (,terraform--block-builtins-with-type-and-name--name-highlight-regexp 3 'terraform--resource-name t)))

(define-derived-mode terraform-mode prog-mode "Terraform"
  ;; other code
  (setq font-lock-defaults '((terraform-font-lock-keywords))))


However, this is causing the issue above where the search based highlighting is
overriding the comment highlighting.

Is there a way to only have search based fontification only override strings but
keep comments unaltered?

Cheers,
Reza

reply via email to

[Prev in Thread] Current Thread [Next in Thread]