diff options
| author | Glenn Morris | 2017-05-05 21:44:09 -0400 |
|---|---|---|
| committer | Glenn Morris | 2017-05-05 21:44:09 -0400 |
| commit | a95fefd1e699ba683331f2813d0956f4142ba986 (patch) | |
| tree | b02fd901463e4b8a5a1a2241e3f6d8c1c9518e42 | |
| parent | 2b91f3d1eac402128c753e0780c50488a4f9cacb (diff) | |
| download | emacs-a95fefd1e699ba683331f2813d0956f4142ba986.tar.gz emacs-a95fefd1e699ba683331f2813d0956f4142ba986.zip | |
Decruftify dns-mode.el a little bit
* lisp/textmodes/dns-mode.el (dns-mode-control-entities):
New constant.
(dns-mode-control-entity, dns-mode-bad-control-entity)
(dns-mode-type, dns-mode-class): New faces.
(dns-mode-control-entity-face, dns-mode-bad-control-entity-face)
(dns-mode-type-face, dns-mode-class): Make these variables use the
new faces, and mark as obsolete.
(dns-mode-font-lock-keywords): Use dns-mode-control-entities.
| -rw-r--r-- | lisp/textmodes/dns-mode.el | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el index 01f509d9136..cc8bad6337b 100644 --- a/lisp/textmodes/dns-mode.el +++ b/lisp/textmodes/dns-mode.el | |||
| @@ -48,6 +48,9 @@ | |||
| 48 | "DNS master file mode configuration." | 48 | "DNS master file mode configuration." |
| 49 | :group 'data) | 49 | :group 'data) |
| 50 | 50 | ||
| 51 | (defconst dns-mode-control-entities '("INCLUDE" "ORIGIN" "TTL") | ||
| 52 | "Lists of strings with known DNS control entities.") | ||
| 53 | |||
| 51 | (defconst dns-mode-classes '("IN" "CS" "CH" "HS") | 54 | (defconst dns-mode-classes '("IN" "CS" "CH" "HS") |
| 52 | "List of strings with known DNS classes.") | 55 | "List of strings with known DNS classes.") |
| 53 | 56 | ||
| @@ -62,28 +65,59 @@ | |||
| 62 | "MAILA" "TLSA" "NSEC3") | 65 | "MAILA" "TLSA" "NSEC3") |
| 63 | "List of strings with known DNS types.") | 66 | "List of strings with known DNS types.") |
| 64 | 67 | ||
| 65 | ;; Font lock. | 68 | (defface dns-mode-control-entity '((t :inherit font-lock-keyword-face)) |
| 69 | "Face used for DNS control entities, e.g. $ORIGIN." | ||
| 70 | :version "26.1" | ||
| 71 | :group 'dns-mode) | ||
| 72 | |||
| 73 | (defface dns-mode-bad-control-entity '((t :inherit font-lock-warning-face)) | ||
| 74 | "Face used for non-standard DNS control entities, e.g. $FOO." | ||
| 75 | :version "26.1" | ||
| 76 | :group 'dns-mode) | ||
| 77 | |||
| 78 | (defface dns-mode-type '((t :inherit font-lock-type-face)) | ||
| 79 | "Face used for DNS types, e.g., SOA." | ||
| 80 | :version "26.1" | ||
| 81 | :group 'dns-mode) | ||
| 82 | |||
| 83 | (defface dns-mode-class '((t :inherit font-lock-constant-face)) | ||
| 84 | "Face used for DNS classes, e.g., IN." | ||
| 85 | :version "26.1" | ||
| 86 | :group 'dns-mode) | ||
| 66 | 87 | ||
| 67 | (defvar dns-mode-control-entity-face 'font-lock-keyword-face | 88 | (defvar dns-mode-control-entity-face ''dns-mode-control-entity |
| 68 | "Name of face used for control entities, e.g. $ORIGIN.") | 89 | "Name of face used for control entities, e.g. $ORIGIN.") |
| 90 | (make-obsolete-variable 'dns-mode-control-entity-face | ||
| 91 | "customize the face `dns-mode-control-entity' instead." | ||
| 92 | "26.1" 'set) | ||
| 69 | 93 | ||
| 70 | (defvar dns-mode-bad-control-entity-face 'font-lock-warning-face | 94 | (defvar dns-mode-bad-control-entity-face ''dns-mode-bad-control-entity |
| 71 | "Name of face used for non-standard control entities, e.g. $FOO.") | 95 | "Name of face used for non-standard control entities, e.g. $FOO.") |
| 96 | (make-obsolete-variable | ||
| 97 | 'dns-mode-bad-control-entity-face | ||
| 98 | "customize the face `dns-mode-bad-control-entity' instead." | ||
| 99 | "26.1" 'set) | ||
| 72 | 100 | ||
| 73 | (defvar dns-mode-type-face 'font-lock-type-face | 101 | (defvar dns-mode-type-face ''dns-mode-type |
| 74 | "Name of face used for DNS types, e.g., SOA.") | 102 | "Name of face used for DNS types, e.g., SOA.") |
| 103 | (make-obsolete-variable 'dns-mode-type-face | ||
| 104 | "customize the face `dns-mode-type' instead." | ||
| 105 | "26.1" 'set) | ||
| 75 | 106 | ||
| 76 | (defvar dns-mode-class-face 'font-lock-constant-face | 107 | (defvar dns-mode-class-face ''dns-mode-class |
| 77 | "Name of face used for DNS classes, e.g., IN.") | 108 | "Name of face used for DNS classes, e.g., IN.") |
| 109 | (make-obsolete-variable 'dns-mode-class | ||
| 110 | "customize the face `dns-mode-class' instead." | ||
| 111 | "26.1" 'set) | ||
| 78 | 112 | ||
| 79 | (defcustom dns-mode-font-lock-keywords | 113 | (defcustom dns-mode-font-lock-keywords |
| 80 | `(("^$ORIGIN" 0 ,dns-mode-control-entity-face) | 114 | `((,(concat "^$" (regexp-opt dns-mode-control-entities)) |
| 81 | ("^$INCLUDE" 0 ,dns-mode-control-entity-face) | 115 | 0 ,dns-mode-control-entity-face) |
| 82 | ("^$TTL" 0 ,dns-mode-control-entity-face) | ||
| 83 | ("^$[a-z0-9A-Z]+" 0 ,dns-mode-bad-control-entity-face) | 116 | ("^$[a-z0-9A-Z]+" 0 ,dns-mode-bad-control-entity-face) |
| 84 | (,(regexp-opt dns-mode-classes) 0 ,dns-mode-class-face) | 117 | (,(regexp-opt dns-mode-classes) 0 ,dns-mode-class-face) |
| 85 | (,(regexp-opt dns-mode-types) 0 ,dns-mode-type-face)) | 118 | (,(regexp-opt dns-mode-types) 0 ,dns-mode-type-face)) |
| 86 | "Font lock keywords used to highlight text in DNS master file mode." | 119 | "Font lock keywords used to highlight text in DNS master file mode." |
| 120 | :version "26.1" | ||
| 87 | :type 'sexp | 121 | :type 'sexp |
| 88 | :group 'dns-mode) | 122 | :group 'dns-mode) |
| 89 | 123 | ||