2004-09-14 11:09:35 +00:00
|
|
|
;;; dns-mode.el --- a mode for viewing/editing Domain Name System master files
|
2005-08-06 17:48:15 +00:00
|
|
|
|
2020-01-01 00:19:43 +00:00
|
|
|
;; Copyright (C) 2000-2001, 2004-2020 Free Software Foundation, Inc.
|
2004-09-14 11:09:35 +00:00
|
|
|
|
|
|
|
;; Author: Simon Josefsson <simon@josefsson.org>
|
2009-11-25 23:52:00 +00:00
|
|
|
;; Keywords: DNS master zone file SOA comm
|
2004-09-14 11:09:35 +00:00
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 04:34:22 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2004-09-14 11:09:35 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 04:34:22 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2004-09-14 11:09:35 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2004-09-14 11:09:35 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; Use M-x dns-mode RET to invoke in master files.
|
|
|
|
;;
|
|
|
|
;; C-c C-s Increment SOA serial.
|
|
|
|
;; Understands YYYYMMDDNN, Unix time, and serial number formats,
|
|
|
|
;; and complains if it fail to find SOA serial.
|
|
|
|
|
|
|
|
;;; References:
|
|
|
|
|
|
|
|
;; RFC 1034, "DOMAIN NAMES - CONCEPTS AND FACILITIES", P. Mockapetris.
|
|
|
|
;; RFC 1035, "DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION", P. Mockapetris.
|
2016-12-23 16:53:41 +06:00
|
|
|
;; RFC 5155, "DNS Security (DNSSEC) Hashed Authenticated Denial of Existence"
|
|
|
|
;; RFC 6698, "The DNS-Based Authentication of Named Entities (DANE)
|
|
|
|
;; Transport Layer Security (TLS) Protocol: TLSA"
|
2017-10-27 16:59:42 +03:00
|
|
|
;; RFC 6844, "DNS Certification Authority Authorization (CAA) Resource Record"
|
2004-09-14 11:09:35 +00:00
|
|
|
|
|
|
|
;;; Release history:
|
|
|
|
|
|
|
|
;; 2004-09-11 Posted on gnu.emacs.sources.
|
|
|
|
;; 2004-09-13 Ported to XEmacs.
|
|
|
|
;; 2004-09-14 Installed in Emacs CVS.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
Explicitly require cl-lib where needed
Rather than relying on the byte-compiler happening to use it.
* lisp/completion.el, lisp/ffap.el, lisp/loadhist.el:
* lisp/userlock.el, lisp/emacs-lisp/debug.el, lisp/emacs-lisp/rx.el:
* lisp/emacs-lisp/testcover.el, lisp/mail/rfc2231.el:
* lisp/net/newst-treeview.el, lisp/net/puny.el:
* lisp/net/tramp-archive.el, lisp/net/tramp-gvfs.el:
* lisp/net/tramp-sh.el, lisp/net/tramp-smb.el, lisp/org/org-ctags.el:
* lisp/org/org-macs.el, lisp/progmodes/grep.el:
* lisp/progmodes/perl-mode.el, lisp/progmodes/ruby-mode.el:
* lisp/textmodes/dns-mode.el, lisp/textmodes/mhtml-mode.el:
* lisp/vc/pcvs-parse.el: Explicitly require cl-lib as needed.
2018-03-16 20:41:17 -04:00
|
|
|
(eval-when-compile (require 'cl-lib))
|
|
|
|
|
2004-09-14 11:09:35 +00:00
|
|
|
(defgroup dns-mode nil
|
2005-05-27 12:32:51 +00:00
|
|
|
"DNS master file mode configuration."
|
|
|
|
:group 'data)
|
2004-09-14 11:09:35 +00:00
|
|
|
|
2017-05-05 21:44:09 -04:00
|
|
|
(defconst dns-mode-control-entities '("INCLUDE" "ORIGIN" "TTL")
|
|
|
|
"Lists of strings with known DNS control entities.")
|
|
|
|
|
2004-09-14 11:09:35 +00:00
|
|
|
(defconst dns-mode-classes '("IN" "CS" "CH" "HS")
|
|
|
|
"List of strings with known DNS classes.")
|
|
|
|
|
|
|
|
(defconst dns-mode-types '("A" "NS" "MD" "MF" "CNAME" "SOA" "MB" "MG" "MR"
|
|
|
|
"NULL" "WKS" "PTR" "HINFO" "MINFO" "MX" "TXT"
|
2016-12-23 16:53:41 +06:00
|
|
|
"RP" "AFSDB" "X25" "ISDN" "RT" "NSAP"
|
2004-09-14 11:09:35 +00:00
|
|
|
"SIG" "KEY" "PX" "GPOS" "AAAA" "LOC" "NXT"
|
|
|
|
"EID" "NIMLOC" "SRV" "ATMA" "NAPTR" "KX" "CERT"
|
|
|
|
"A6" "DNAME" "SINK" "OPT" "APL" "DS" "SSHFP"
|
|
|
|
"RRSIG" "NSEC" "DNSKEY" "UINFO" "UID" "GID"
|
|
|
|
"UNSPEC" "TKEY" "TSIG" "IXFR" "AXFR" "MAILB"
|
2017-10-27 16:59:42 +03:00
|
|
|
"MAILA" "TLSA" "NSEC3" "CAA")
|
2004-09-14 11:09:35 +00:00
|
|
|
"List of strings with known DNS types.")
|
|
|
|
|
2017-05-05 21:44:09 -04:00
|
|
|
(defface dns-mode-control-entity '((t :inherit font-lock-keyword-face))
|
|
|
|
"Face used for DNS control entities, e.g. $ORIGIN."
|
|
|
|
:version "26.1"
|
|
|
|
:group 'dns-mode)
|
|
|
|
|
|
|
|
(defface dns-mode-bad-control-entity '((t :inherit font-lock-warning-face))
|
|
|
|
"Face used for non-standard DNS control entities, e.g. $FOO."
|
|
|
|
:version "26.1"
|
|
|
|
:group 'dns-mode)
|
|
|
|
|
|
|
|
(defface dns-mode-type '((t :inherit font-lock-type-face))
|
|
|
|
"Face used for DNS types, e.g., SOA."
|
|
|
|
:version "26.1"
|
|
|
|
:group 'dns-mode)
|
|
|
|
|
|
|
|
(defface dns-mode-class '((t :inherit font-lock-constant-face))
|
|
|
|
"Face used for DNS classes, e.g., IN."
|
|
|
|
:version "26.1"
|
|
|
|
:group 'dns-mode)
|
2004-09-14 11:09:35 +00:00
|
|
|
|
2017-05-05 21:44:09 -04:00
|
|
|
(defvar dns-mode-control-entity-face ''dns-mode-control-entity
|
2004-09-14 11:09:35 +00:00
|
|
|
"Name of face used for control entities, e.g. $ORIGIN.")
|
2017-05-05 21:44:09 -04:00
|
|
|
(make-obsolete-variable 'dns-mode-control-entity-face
|
|
|
|
"customize the face `dns-mode-control-entity' instead."
|
|
|
|
"26.1" 'set)
|
2004-09-14 11:09:35 +00:00
|
|
|
|
2017-05-05 21:44:09 -04:00
|
|
|
(defvar dns-mode-bad-control-entity-face ''dns-mode-bad-control-entity
|
2004-09-14 11:09:35 +00:00
|
|
|
"Name of face used for non-standard control entities, e.g. $FOO.")
|
2017-05-05 21:44:09 -04:00
|
|
|
(make-obsolete-variable
|
|
|
|
'dns-mode-bad-control-entity-face
|
|
|
|
"customize the face `dns-mode-bad-control-entity' instead."
|
|
|
|
"26.1" 'set)
|
2004-09-14 11:09:35 +00:00
|
|
|
|
2017-05-05 21:44:09 -04:00
|
|
|
(defvar dns-mode-type-face ''dns-mode-type
|
2004-09-14 11:09:35 +00:00
|
|
|
"Name of face used for DNS types, e.g., SOA.")
|
2017-05-05 21:44:09 -04:00
|
|
|
(make-obsolete-variable 'dns-mode-type-face
|
|
|
|
"customize the face `dns-mode-type' instead."
|
|
|
|
"26.1" 'set)
|
2004-09-14 11:09:35 +00:00
|
|
|
|
2017-05-05 21:44:09 -04:00
|
|
|
(defvar dns-mode-class-face ''dns-mode-class
|
2004-09-14 11:09:35 +00:00
|
|
|
"Name of face used for DNS classes, e.g., IN.")
|
2017-05-05 21:44:09 -04:00
|
|
|
(make-obsolete-variable 'dns-mode-class
|
|
|
|
"customize the face `dns-mode-class' instead."
|
|
|
|
"26.1" 'set)
|
2004-09-14 11:09:35 +00:00
|
|
|
|
|
|
|
(defcustom dns-mode-font-lock-keywords
|
Fix regular-expression glitches and typos
Problems reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00085.html
* admin/admin.el (set-version):
* lisp/allout.el (allout-latexify-one-item):
* lisp/arc-mode.el (archive-arc-rename-entry)
(archive-rar-summarize):
* lisp/calc/calc-graph.el (calc-graph-set-styles)
(calc-graph-hide):
* lisp/calc/calc-help.el (calc-describe-key):
* lisp/calc/calc-lang.el (math-compose-tex-func, eqn):
* lisp/calc/calc.el (calcDigit-key):
* lisp/cedet/ede/makefile-edit.el (makefile-macro-file-list):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/comint.el (comint-substitute-in-file-name):
* lisp/dired.el (dired-actual-switches):
* lisp/emacs-lisp/chart.el (chart-rmail-from):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/rx.el (rx-not, rx-atomic-p):
* lisp/emulation/viper-ex.el (viper-get-ex-token)
(viper-get-ex-pat, ex-set-read-variable):
* lisp/epg.el (epg--status-SIG_CREATED):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-user):
(erc-speedbar-expand-channel, erc-speedbar-expand-server)
* lisp/erc/erc.el (erc-is-message-ctcp-and-not-action-p)
(erc-banlist-update):
* lisp/eshell/em-dirs.el (eshell-parse-drive-letter, eshell/pwd):
* lisp/find-dired.el (find-dired):
* lisp/frame.el (frame-set-background-mode):
* lisp/generic-x.el (apache-log-generic-mode):
* lisp/gnus/gnus-art.el (gnus-button-valid-localpart-regexp):
* lisp/gnus/gnus.el (gnus-short-group-name):
* lisp/gnus/message.el (message-mailer-swallows-blank-line):
* lisp/ibuffer.el (ibuffer-fontification-alist):
* lisp/ido.el (ido-set-matches-1):
* lisp/info-xref.el (info-xref-lock-file-p):
* lisp/info.el (Info-dir-remove-duplicates)
(Info-unescape-quotes, Info-split-parameter-string)
(Info-speedbar-expand-node):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/language/ethio-util.el (ethio-fidel-to-tex-buffer):
* lisp/mail/rmail.el (rmail-collect-deleted):
* lisp/mh-e/mh-alias.el (mh-alias-suggest-alias):
* lisp/mh-e/mh-comp.el (mh-forward):
* lisp/mh-e/mh-search.el (mh-index-next-folder)
(mh-index-create-imenu-index):
* lisp/mh-e/mh-xface.el (mh-picon-get-image):
* lisp/minibuffer.el (completion--embedded-envvar-re):
* lisp/net/ange-ftp.el (ange-ftp-ls-parser):
* lisp/net/goto-addr.el (goto-address-mail-regexp)
(goto-address-find-address-at-point):
* lisp/net/pop3.el (pop3-read-response, pop3-user)
(pop3-pass, pop3-apop):
* lisp/net/tramp.el (tramp-ipv6-regexp)
(tramp-replace-environment-variables):
* lisp/nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set):
* lisp/nxml/rng-uri.el (rng-uri-escape-multibyte):
* lisp/nxml/rng-xsd.el (rng-xsd-convert-any-uri):
* lisp/obsolete/pgg.el (pgg-fetch-key):
* lisp/obsolete/vip.el (vip-get-ex-token):
* lisp/org/ob-core.el (org-babel-string-read):
* lisp/org/org-agenda.el:
(org-agenda-add-entry-to-org-agenda-diary-file):
* lisp/org/org-element.el (org-element-keyword-parser):
* lisp/org/org-list.el (org-list-indent-item-generic):
* lisp/org/org-mhe.el (org-mhe-get-message-folder-from-index):
* lisp/org/org-mobile.el (org-mobile-apply):
* lisp/org/org-mouse.el (org-mouse-context-menu):
* lisp/org/org-plot.el (org-plot/gnuplot):
* lisp/org/org-protocol.el (org-protocol-flatten-greedy):
* lisp/org/org-table.el (org-table-copy-down)
(org-table-formula-make-cmp-string)
(org-table-get-stored-formulas, org-table-recalculate)
(org-table-edit-formulas):
* lisp/org/org.el (org-translate-link-from-planner)
(org-fill-line-break-nobreak-p):
* lisp/org/ox-ascii.el (org-ascii-item):
* lisp/org/ox-latex.el (org-latex-clean-invalid-line-breaks):
* lisp/org/ox.el (org-export-expand-include-keyword):
* lisp/progmodes/ada-xref.el (ada-treat-cmd-string):
* lisp/progmodes/cfengine.el (cfengine2-font-lock-keywords):
* lisp/progmodes/cperl-mode.el (cperl-to-comment-or-eol)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-have-help-regexp, cperl-word-at-point-hard)
(cperl-make-regexp-x):
* lisp/progmodes/dcl-mode.el (dcl-option-value-offset):
* lisp/progmodes/etags.el (tag-implicit-name-match-p):
* lisp/progmodes/fortran.el (fortran-fill):
* lisp/progmodes/gdb-mi.el (gdb-speedbar-expand-node)
(gdb-locals-handler-custom):
* lisp/progmodes/grep.el (grep-mode-font-lock-keywords):
* lisp/progmodes/gud.el (gud-jdb-find-source-using-classpath):
* lisp/progmodes/js.el (js--continued-expression-p):
* lisp/progmodes/m4-mode.el (m4-font-lock-keywords):
* lisp/progmodes/meta-mode.el (meta-indent-level-count):
* lisp/progmodes/mixal-mode.el (mixal-font-lock-keywords):
* lisp/progmodes/opascal.el (opascal-find-unit-in-directory):
* lisp/progmodes/pascal.el (pascal-progbeg-re):
* lisp/progmodes/ruby-mode.el (ruby-expression-expansion-re)
(ruby-expr-beg, ruby-parse-partial)
(ruby-toggle-string-quotes, ruby-font-lock-keywords):
* lisp/progmodes/sql.el (sql--make-help-docstring):
* lisp/progmodes/verilog-mode.el (verilog-coverpoint-re)
(verilog-skip-forward-comment-p)
(verilog-read-sub-decls-gate)
(verilog-read-auto-template-middle):
* lisp/progmodes/vhdl-mode.el (vhdl-resolve-env-variable)
(vhdl-speedbar-expand-project, vhdl-speedbar-expand-entity)
(vhdl-speedbar-expand-architecture)
(vhdl-speedbar-expand-config, vhdl-speedbar-expand-package)
(vhdl-speedbar-dired):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/textmodes/dns-mode.el (dns-mode-font-lock-keywords):
* lisp/textmodes/flyspell.el (flyspell-debug-signal-word-checked):
* lisp/textmodes/ispell.el (ispell-process-line):
* lisp/textmodes/reftex-cite.el (reftex-end-of-bib-entry):
* lisp/textmodes/reftex-ref.el (reftex-replace-prefix-escapes):
* lisp/url/url-parse.el (url-generic-parse-url):
* lisp/url/url-util.el (url-truncate-url-for-viewing):
* lisp/vc/diff-mode.el (diff-unified->context):
* lisp/vc/vc-bzr.el (vc-bzr-error-regexp-alist):
* lisp/vc/vc-cvs.el (vc-cvs-parse-status):
* lisp/woman.el (woman0-el, woman-if-ignore)
(woman-change-fonts):
* lisp/xdg.el (xdg--substitute-home-env):
Fix regular-expression infelicities and typos.
Fix regular expression typos
Fix typos reported by Mattias Engdegård in:
that occurred in preloaded modules.
* lisp/frame.el (frame-set-background-mode):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/minibuffer.el (completion--embedded-envvar-re):
2019-03-04 18:00:00 -08:00
|
|
|
`((,(concat "^\\$" (regexp-opt dns-mode-control-entities))
|
2017-05-05 21:44:09 -04:00
|
|
|
0 ,dns-mode-control-entity-face)
|
Fix regular-expression glitches and typos
Problems reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2019-03/msg00085.html
* admin/admin.el (set-version):
* lisp/allout.el (allout-latexify-one-item):
* lisp/arc-mode.el (archive-arc-rename-entry)
(archive-rar-summarize):
* lisp/calc/calc-graph.el (calc-graph-set-styles)
(calc-graph-hide):
* lisp/calc/calc-help.el (calc-describe-key):
* lisp/calc/calc-lang.el (math-compose-tex-func, eqn):
* lisp/calc/calc.el (calcDigit-key):
* lisp/cedet/ede/makefile-edit.el (makefile-macro-file-list):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/comint.el (comint-substitute-in-file-name):
* lisp/dired.el (dired-actual-switches):
* lisp/emacs-lisp/chart.el (chart-rmail-from):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/rx.el (rx-not, rx-atomic-p):
* lisp/emulation/viper-ex.el (viper-get-ex-token)
(viper-get-ex-pat, ex-set-read-variable):
* lisp/epg.el (epg--status-SIG_CREATED):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-user):
(erc-speedbar-expand-channel, erc-speedbar-expand-server)
* lisp/erc/erc.el (erc-is-message-ctcp-and-not-action-p)
(erc-banlist-update):
* lisp/eshell/em-dirs.el (eshell-parse-drive-letter, eshell/pwd):
* lisp/find-dired.el (find-dired):
* lisp/frame.el (frame-set-background-mode):
* lisp/generic-x.el (apache-log-generic-mode):
* lisp/gnus/gnus-art.el (gnus-button-valid-localpart-regexp):
* lisp/gnus/gnus.el (gnus-short-group-name):
* lisp/gnus/message.el (message-mailer-swallows-blank-line):
* lisp/ibuffer.el (ibuffer-fontification-alist):
* lisp/ido.el (ido-set-matches-1):
* lisp/info-xref.el (info-xref-lock-file-p):
* lisp/info.el (Info-dir-remove-duplicates)
(Info-unescape-quotes, Info-split-parameter-string)
(Info-speedbar-expand-node):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/language/ethio-util.el (ethio-fidel-to-tex-buffer):
* lisp/mail/rmail.el (rmail-collect-deleted):
* lisp/mh-e/mh-alias.el (mh-alias-suggest-alias):
* lisp/mh-e/mh-comp.el (mh-forward):
* lisp/mh-e/mh-search.el (mh-index-next-folder)
(mh-index-create-imenu-index):
* lisp/mh-e/mh-xface.el (mh-picon-get-image):
* lisp/minibuffer.el (completion--embedded-envvar-re):
* lisp/net/ange-ftp.el (ange-ftp-ls-parser):
* lisp/net/goto-addr.el (goto-address-mail-regexp)
(goto-address-find-address-at-point):
* lisp/net/pop3.el (pop3-read-response, pop3-user)
(pop3-pass, pop3-apop):
* lisp/net/tramp.el (tramp-ipv6-regexp)
(tramp-replace-environment-variables):
* lisp/nxml/nxml-maint.el (nxml-insert-target-repertoire-glyph-set):
* lisp/nxml/rng-uri.el (rng-uri-escape-multibyte):
* lisp/nxml/rng-xsd.el (rng-xsd-convert-any-uri):
* lisp/obsolete/pgg.el (pgg-fetch-key):
* lisp/obsolete/vip.el (vip-get-ex-token):
* lisp/org/ob-core.el (org-babel-string-read):
* lisp/org/org-agenda.el:
(org-agenda-add-entry-to-org-agenda-diary-file):
* lisp/org/org-element.el (org-element-keyword-parser):
* lisp/org/org-list.el (org-list-indent-item-generic):
* lisp/org/org-mhe.el (org-mhe-get-message-folder-from-index):
* lisp/org/org-mobile.el (org-mobile-apply):
* lisp/org/org-mouse.el (org-mouse-context-menu):
* lisp/org/org-plot.el (org-plot/gnuplot):
* lisp/org/org-protocol.el (org-protocol-flatten-greedy):
* lisp/org/org-table.el (org-table-copy-down)
(org-table-formula-make-cmp-string)
(org-table-get-stored-formulas, org-table-recalculate)
(org-table-edit-formulas):
* lisp/org/org.el (org-translate-link-from-planner)
(org-fill-line-break-nobreak-p):
* lisp/org/ox-ascii.el (org-ascii-item):
* lisp/org/ox-latex.el (org-latex-clean-invalid-line-breaks):
* lisp/org/ox.el (org-export-expand-include-keyword):
* lisp/progmodes/ada-xref.el (ada-treat-cmd-string):
* lisp/progmodes/cfengine.el (cfengine2-font-lock-keywords):
* lisp/progmodes/cperl-mode.el (cperl-to-comment-or-eol)
(cperl-find-pods-heres, cperl-fix-line-spacing)
(cperl-have-help-regexp, cperl-word-at-point-hard)
(cperl-make-regexp-x):
* lisp/progmodes/dcl-mode.el (dcl-option-value-offset):
* lisp/progmodes/etags.el (tag-implicit-name-match-p):
* lisp/progmodes/fortran.el (fortran-fill):
* lisp/progmodes/gdb-mi.el (gdb-speedbar-expand-node)
(gdb-locals-handler-custom):
* lisp/progmodes/grep.el (grep-mode-font-lock-keywords):
* lisp/progmodes/gud.el (gud-jdb-find-source-using-classpath):
* lisp/progmodes/js.el (js--continued-expression-p):
* lisp/progmodes/m4-mode.el (m4-font-lock-keywords):
* lisp/progmodes/meta-mode.el (meta-indent-level-count):
* lisp/progmodes/mixal-mode.el (mixal-font-lock-keywords):
* lisp/progmodes/opascal.el (opascal-find-unit-in-directory):
* lisp/progmodes/pascal.el (pascal-progbeg-re):
* lisp/progmodes/ruby-mode.el (ruby-expression-expansion-re)
(ruby-expr-beg, ruby-parse-partial)
(ruby-toggle-string-quotes, ruby-font-lock-keywords):
* lisp/progmodes/sql.el (sql--make-help-docstring):
* lisp/progmodes/verilog-mode.el (verilog-coverpoint-re)
(verilog-skip-forward-comment-p)
(verilog-read-sub-decls-gate)
(verilog-read-auto-template-middle):
* lisp/progmodes/vhdl-mode.el (vhdl-resolve-env-variable)
(vhdl-speedbar-expand-project, vhdl-speedbar-expand-entity)
(vhdl-speedbar-expand-architecture)
(vhdl-speedbar-expand-config, vhdl-speedbar-expand-package)
(vhdl-speedbar-dired):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/textmodes/dns-mode.el (dns-mode-font-lock-keywords):
* lisp/textmodes/flyspell.el (flyspell-debug-signal-word-checked):
* lisp/textmodes/ispell.el (ispell-process-line):
* lisp/textmodes/reftex-cite.el (reftex-end-of-bib-entry):
* lisp/textmodes/reftex-ref.el (reftex-replace-prefix-escapes):
* lisp/url/url-parse.el (url-generic-parse-url):
* lisp/url/url-util.el (url-truncate-url-for-viewing):
* lisp/vc/diff-mode.el (diff-unified->context):
* lisp/vc/vc-bzr.el (vc-bzr-error-regexp-alist):
* lisp/vc/vc-cvs.el (vc-cvs-parse-status):
* lisp/woman.el (woman0-el, woman-if-ignore)
(woman-change-fonts):
* lisp/xdg.el (xdg--substitute-home-env):
Fix regular-expression infelicities and typos.
Fix regular expression typos
Fix typos reported by Mattias Engdegård in:
that occurred in preloaded modules.
* lisp/frame.el (frame-set-background-mode):
* lisp/international/mule.el (sgml-html-meta-auto-coding-function):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/minibuffer.el (completion--embedded-envvar-re):
2019-03-04 18:00:00 -08:00
|
|
|
("^\\$[a-z0-9A-Z]+" 0 ,dns-mode-bad-control-entity-face)
|
2004-09-14 11:09:35 +00:00
|
|
|
(,(regexp-opt dns-mode-classes) 0 ,dns-mode-class-face)
|
|
|
|
(,(regexp-opt dns-mode-types) 0 ,dns-mode-type-face))
|
|
|
|
"Font lock keywords used to highlight text in DNS master file mode."
|
2017-05-05 21:44:09 -04:00
|
|
|
:version "26.1"
|
2004-09-14 11:09:35 +00:00
|
|
|
:type 'sexp
|
|
|
|
:group 'dns-mode)
|
|
|
|
|
2006-08-10 20:06:19 +00:00
|
|
|
(defcustom dns-mode-soa-auto-increment-serial t
|
|
|
|
"Whether to increment the SOA serial number automatically.
|
|
|
|
|
|
|
|
If this variable is t, the serial number is incremented upon each save of
|
|
|
|
the file. If it is `ask', Emacs asks for confirmation whether it should
|
|
|
|
increment the serial upon saving. If nil, serials must be incremented
|
|
|
|
manually with \\[dns-mode-soa-increment-serial]."
|
|
|
|
:type '(choice (const :tag "Always" t)
|
|
|
|
(const :tag "Ask" ask)
|
|
|
|
(const :tag "Never" nil))
|
2020-01-27 21:28:21 -08:00
|
|
|
:safe 'symbolp
|
2006-08-10 20:06:19 +00:00
|
|
|
:group 'dns-mode)
|
|
|
|
|
2004-09-14 11:09:35 +00:00
|
|
|
;; Syntax table.
|
|
|
|
|
|
|
|
(defvar dns-mode-syntax-table
|
|
|
|
(let ((table (make-syntax-table)))
|
|
|
|
(modify-syntax-entry ?\; "< " table)
|
|
|
|
(modify-syntax-entry ?\n "> " table)
|
|
|
|
table)
|
|
|
|
"Syntax table in use in DNS master file buffers.")
|
|
|
|
|
|
|
|
;; Keymap.
|
|
|
|
|
|
|
|
(defvar dns-mode-map
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
(define-key map "\C-c\C-s" 'dns-mode-soa-increment-serial)
|
2017-05-23 20:34:08 -04:00
|
|
|
(define-key map "\C-c\C-e" 'dns-mode-ipv6-to-nibbles)
|
2004-09-14 11:09:35 +00:00
|
|
|
map)
|
|
|
|
"Keymap for DNS master file mode.")
|
|
|
|
|
|
|
|
;; Menu.
|
|
|
|
|
|
|
|
(defvar dns-mode-menu nil
|
|
|
|
"Menubar used in DNS master file mode.")
|
|
|
|
|
|
|
|
(easy-menu-define dns-mode-menu dns-mode-map
|
|
|
|
"DNS Menu."
|
|
|
|
'("DNS"
|
2017-05-23 20:34:08 -04:00
|
|
|
["Increment SOA serial" dns-mode-soa-increment-serial t]
|
|
|
|
["Convert IPv6 address to nibbles" dns-mode-ipv6-to-nibbles t]))
|
2004-09-14 11:09:35 +00:00
|
|
|
|
|
|
|
;; Mode.
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(define-derived-mode dns-mode text-mode "DNS"
|
|
|
|
"Major mode for viewing and editing DNS master files.
|
|
|
|
This mode is inherited from text mode. It add syntax
|
|
|
|
highlighting, and some commands for handling DNS master files.
|
|
|
|
Its keymap inherits from `text-mode' and it has the same
|
|
|
|
variables for customizing indentation. It has its own abbrev
|
|
|
|
table and its own syntax table.
|
|
|
|
|
|
|
|
Turning on DNS mode runs `dns-mode-hook'."
|
|
|
|
(set (make-local-variable 'comment-start) ";")
|
|
|
|
(set (make-local-variable 'comment-end) "")
|
|
|
|
(set (make-local-variable 'comment-start-skip) ";+ *")
|
2019-06-20 01:15:30 +02:00
|
|
|
(set (make-local-variable 'font-lock-defaults)
|
|
|
|
'(dns-mode-font-lock-keywords nil nil ((?_ . "w"))))
|
2006-08-11 13:56:50 +00:00
|
|
|
(add-hook 'before-save-hook 'dns-mode-soa-maybe-increment-serial
|
2006-08-10 20:06:19 +00:00
|
|
|
nil t)
|
2004-09-14 11:09:35 +00:00
|
|
|
(easy-menu-add dns-mode-menu dns-mode-map))
|
|
|
|
|
2006-08-10 20:06:19 +00:00
|
|
|
;;;###autoload (defalias 'zone-mode 'dns-mode)
|
|
|
|
|
2004-09-14 11:09:35 +00:00
|
|
|
;; Tools.
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun dns-mode-soa-increment-serial ()
|
|
|
|
"Locate SOA record and increment the serial field."
|
|
|
|
(interactive)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(unless (re-search-forward
|
|
|
|
(concat "^\\(\\(\\([^ \t]+[ \t]+\\)?[^ \t]+"
|
|
|
|
"[ \t]+\\)?[^ \t]+[ \t]+\\)?SOA") nil t)
|
|
|
|
(error "Cannot locate SOA record"))
|
|
|
|
(if (re-search-forward (concat "\\<\\("
|
|
|
|
;; year
|
|
|
|
"\\(198\\|199\\|20[0-9]\\)[0-9]"
|
|
|
|
;; month
|
|
|
|
"\\(0[0-9]\\|10\\|11\\|12\\)"
|
|
|
|
;; day
|
|
|
|
"\\([012][0-9]\\|30\\|31\\)"
|
|
|
|
;; counter
|
|
|
|
"\\([0-9]\\{1,3\\}\\)"
|
|
|
|
"\\)\\>")
|
|
|
|
nil t)
|
|
|
|
;; YYYYMMDDIII format, one to three I's.
|
|
|
|
(let* ((serial (match-string 1))
|
|
|
|
(counterstr (match-string 5))
|
|
|
|
(counter (string-to-number counterstr))
|
|
|
|
(now (format-time-string "%Y%m%d"))
|
|
|
|
(nowandoldserial (concat now counterstr)))
|
|
|
|
(if (string< serial nowandoldserial)
|
|
|
|
(let ((new (format "%s00" now)))
|
|
|
|
(replace-match new nil nil nil 1)
|
|
|
|
(message "Replaced old serial %s with %s" serial new))
|
|
|
|
(if (string= serial nowandoldserial)
|
|
|
|
(let ((new (format (format "%%s%%0%dd" (length counterstr))
|
|
|
|
now (1+ counter))))
|
|
|
|
(replace-match new nil nil nil 1)
|
|
|
|
(message "Replaced old serial %s with %s" serial new))
|
|
|
|
(error "Current SOA serial is in the future"))))
|
|
|
|
(if (re-search-forward "\\<\\([0-9]\\{9,10\\}\\)\\>" nil t)
|
|
|
|
;; Unix time
|
|
|
|
(let* ((serial (match-string 1))
|
|
|
|
(new (format-time-string "%s")))
|
|
|
|
(if (not (string< serial new))
|
|
|
|
(error "Current SOA serial is in the future")
|
|
|
|
(replace-match new nil nil nil 1)
|
|
|
|
(message "Replaced old serial %s with %s" serial new)))
|
|
|
|
(if (re-search-forward "\\<\\([0-9]+\\)\\>" nil t)
|
|
|
|
;; Just any serial number.
|
|
|
|
(let* ((serial (match-string 1))
|
|
|
|
(new (format "%d" (1+ (string-to-number serial)))))
|
|
|
|
(replace-match new nil nil nil 1)
|
|
|
|
(message "Replaced old serial %s with %s" serial new))
|
|
|
|
(error "Cannot locate serial number in SOA record"))))))
|
|
|
|
|
2006-08-10 20:06:19 +00:00
|
|
|
(defun dns-mode-soa-maybe-increment-serial ()
|
|
|
|
"Increment SOA serial if needed.
|
|
|
|
|
2006-08-11 13:56:50 +00:00
|
|
|
This function is run from `before-save-hook'."
|
2006-08-10 20:06:19 +00:00
|
|
|
(when (and (buffer-modified-p)
|
|
|
|
dns-mode-soa-auto-increment-serial
|
|
|
|
(or (eq dns-mode-soa-auto-increment-serial t)
|
|
|
|
(y-or-n-p "Increment SOA serial? ")))
|
2006-08-11 14:11:24 +00:00
|
|
|
;; If `dns-mode-soa-increment-serial' signals an error saving will
|
|
|
|
;; fail but that probably means that the serial should be fixed to
|
|
|
|
;; comply with the RFC anyway! -rfr
|
2006-08-11 13:56:50 +00:00
|
|
|
(progn (dns-mode-soa-increment-serial)
|
2006-08-11 14:11:24 +00:00
|
|
|
;; We return nil in case this is used in write-contents-functions.
|
|
|
|
nil)))
|
2006-08-10 20:06:19 +00:00
|
|
|
|
2017-05-23 20:34:08 -04:00
|
|
|
(defun dns-mode-ipv6-to-nibbles (&optional negate-prefix)
|
|
|
|
"Convert an IPv6 address around or before point.
|
|
|
|
Replace the address by its ip6.arpa-representation for use in
|
|
|
|
reverse zone files, placing the original address in the kill ring.
|
|
|
|
|
|
|
|
The address can be: a complete address (no prefix designator);
|
|
|
|
with a normal prefix designator (e.g. /48), in which case only
|
|
|
|
the required number of nibbles are output; or with a negative
|
|
|
|
prefix designator (e.g. /-112), in which case only the part of
|
|
|
|
the address *not* covered by the absolute value of the prefix
|
|
|
|
length is output, as a relative address (without \".ip6.arpa.\" at
|
|
|
|
the end). This is useful when $ORIGIN is specified in the zone file.
|
|
|
|
|
|
|
|
Optional prefix argument NEGATE-PREFIX negates the value of the
|
|
|
|
detected prefix length.
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
2001:db8::12 =>
|
|
|
|
2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
|
|
|
|
|
|
|
|
2001:db8::12/32 =>
|
|
|
|
8.b.d.0.1.0.0.2.ip6.arpa.
|
|
|
|
|
|
|
|
2001:db8::12/-32 =>
|
|
|
|
2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
|
|
|
|
|
|
|
|
::42/112 (with prefix argument) =>
|
|
|
|
2.4.0.0"
|
|
|
|
(interactive "P")
|
|
|
|
(skip-syntax-backward " ")
|
|
|
|
(skip-syntax-backward "w_.")
|
|
|
|
(re-search-forward "\\([[:xdigit:]:]+\\)\\(/-?[0-9]\\{2,3\\}\\)?")
|
|
|
|
(let ((address (match-string 1))
|
|
|
|
(prefix-length (match-string 2)))
|
2019-03-25 11:29:07 -07:00
|
|
|
(kill-new (match-string 0))
|
2017-05-23 20:34:08 -04:00
|
|
|
(when prefix-length
|
|
|
|
(setq prefix-length (string-to-number (substring prefix-length 1)))
|
|
|
|
(if negate-prefix
|
|
|
|
(setq prefix-length (- prefix-length))))
|
|
|
|
(replace-match
|
|
|
|
(save-match-data
|
|
|
|
(dns-mode-reverse-and-expand-ipv6 address prefix-length)))))
|
|
|
|
|
|
|
|
(defun dns-mode-reverse-and-expand-ipv6 (address &optional prefix-length)
|
|
|
|
"Convert an IPv6 address to (parts of) an ip6.arpa nibble format.
|
|
|
|
ADDRESS is an IPv6 address in the usual colon-separated
|
|
|
|
format, without a prefix designator at the end.
|
|
|
|
|
|
|
|
Optional PREFIX-LENGTH is a number whose absolute value is the
|
|
|
|
length in bits of the network part of the address. If nil,
|
|
|
|
return an absolute address representing the full IPv6 address.
|
|
|
|
If positive, return an absolute address representing the network
|
|
|
|
prefix indicated. If negative, return a relative address
|
|
|
|
representing the host parts of the address with respect to the
|
|
|
|
indicated network prefix.
|
|
|
|
|
|
|
|
See `dns-mode-ipv6-to-nibbles' for examples."
|
|
|
|
(let* ((chunks (split-string address ":"))
|
|
|
|
(prefix-length-nibbles (if prefix-length
|
|
|
|
(ceiling (abs prefix-length) 4)
|
|
|
|
32))
|
|
|
|
(filler-chunks (- 8 (length (remove "" chunks))))
|
|
|
|
(expanded-address
|
|
|
|
(apply #'concat
|
|
|
|
(cl-loop with filler-done = nil
|
|
|
|
for chunk in chunks
|
|
|
|
if (and (not filler-done)
|
|
|
|
(string= "" chunk))
|
|
|
|
append (prog1
|
|
|
|
(cl-loop repeat filler-chunks
|
|
|
|
collect "0000")
|
|
|
|
(setq filler-done t))
|
|
|
|
else
|
|
|
|
if (not (string= "" chunk))
|
|
|
|
collect (format "%04x"
|
|
|
|
(string-to-number chunk 16)))))
|
|
|
|
(rev-address-nibbles
|
|
|
|
(nreverse (if (and prefix-length
|
|
|
|
(cl-minusp prefix-length))
|
|
|
|
(substring expanded-address prefix-length-nibbles)
|
|
|
|
(substring expanded-address 0 prefix-length-nibbles)))))
|
|
|
|
(with-temp-buffer
|
|
|
|
(cl-loop for char across rev-address-nibbles
|
|
|
|
do
|
|
|
|
(insert char)
|
|
|
|
(insert "."))
|
|
|
|
(if (and prefix-length
|
|
|
|
(cl-minusp prefix-length))
|
|
|
|
(delete-char -1)
|
|
|
|
(insert "ip6.arpa."))
|
|
|
|
(insert " ")
|
|
|
|
(buffer-string))))
|
|
|
|
|
2004-09-14 11:09:35 +00:00
|
|
|
(provide 'dns-mode)
|
|
|
|
|
|
|
|
;;; dns-mode.el ends here
|