unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Help with Fontification
@ 2021-11-03  4:00 Reza Nikoopour
  2021-11-03 11:56 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Reza Nikoopour @ 2021-11-03  4:00 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1076 bytes --]

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: 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

[-- Attachment #1.2: Type: text/html, Size: 1383 bytes --]

[-- Attachment #2: image.png --]
[-- Type: image/png, Size: 7516 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-03 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-03  4:00 Help with Fontification Reza Nikoopour
2021-11-03 11:56 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).