Subject: bug#55944: [PATCH] Fix dns-mode-font-lock-keywords

From: Lassi Kortela <[email-masked]>
Date: Mon, 13 Jun 2022 13:58:08 +0300

Attached is a simple fix to the syntax highlighting of dns-mode.

For example, IN and SOA are reserved words. Instead of highlighting only 
the full words IN and SOA, dns-mode would highlight any word that has IN 
or SOA as a substring. This patch fixes the use of regexp-opt such that 
reserved words are only highlighted when they are full words.

--- dns-mode.el.orig	2022-06-13 13:25:03.000000000 +0300
+++ dns-mode.el	2022-06-13 13:31:15.000000000 +0300
@@ -110,11 +110,11 @@
 			"26.1" 'set)
 
 (defcustom dns-mode-font-lock-keywords
-  `((,(concat "^\\$" (regexp-opt dns-mode-control-entities))
+  `((,(concat "^\\$" (regexp-opt dns-mode-control-entities) "\\>")
      0 ,dns-mode-control-entity-face)
     ("^\\$[a-z0-9A-Z]+" 0 ,dns-mode-bad-control-entity-face)
-    (,(regexp-opt dns-mode-classes) 0 ,dns-mode-class-face)
-    (,(regexp-opt dns-mode-types) 0 ,dns-mode-type-face))
+    (,(regexp-opt dns-mode-classes 'words) 0 ,dns-mode-class-face)
+    (,(regexp-opt dns-mode-types 'words) 0 ,dns-mode-type-face))
   "Font lock keywords used to highlight text in DNS master file mode."
   :version "26.1"
   :type 'sexp)