diff options
| author | Romain Francoise | 2006-08-10 20:06:19 +0000 |
|---|---|---|
| committer | Romain Francoise | 2006-08-10 20:06:19 +0000 |
| commit | c40408fbe7d325d81ebe784f9565edb39ca23d9f (patch) | |
| tree | e8e9e6b19eef6dcb9a80597a1eee419c3a4ef8c7 /lisp | |
| parent | 43901444a44d09f2fab59a1127e2659426dcd53e (diff) | |
| download | emacs-c40408fbe7d325d81ebe784f9565edb39ca23d9f.tar.gz emacs-c40408fbe7d325d81ebe784f9565edb39ca23d9f.zip | |
* textmodes/dns-mode.el: Alias `zone-mode' to `dns-mode'.
(dns-mode-soa-auto-increment-serial): New user option.
(dns-mode-soa-maybe-increment-serial): New function.
(dns-mode): Add the latter to `write-contents-functions'.
* obsolete/zone-mode.el: Move to obsolete/ from net/.
Delete autoload cookies.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/obsolete/zone-mode.el (renamed from lisp/net/zone-mode.el) | 2 | ||||
| -rw-r--r-- | lisp/textmodes/dns-mode.el | 29 |
3 files changed, 39 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 213f5939f62..a994da42625 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2006-08-10 Romain Francoise <romain@orebokech.com> | ||
| 2 | |||
| 3 | * textmodes/dns-mode.el: Alias `zone-mode' to `dns-mode'. | ||
| 4 | (dns-mode-soa-auto-increment-serial): New user option. | ||
| 5 | (dns-mode-soa-maybe-increment-serial): New function. | ||
| 6 | (dns-mode): Add the latter to `write-contents-functions'. | ||
| 7 | |||
| 8 | * obsolete/zone-mode.el: Move to obsolete/ from net/. | ||
| 9 | Delete autoload cookies. | ||
| 10 | |||
| 1 | 2006-08-10 John Wiegley <johnw@newartisans.com> | 11 | 2006-08-10 John Wiegley <johnw@newartisans.com> |
| 2 | 12 | ||
| 3 | * eshell/em-glob.el (eshell-glob-chars-list) | 13 | * eshell/em-glob.el (eshell-glob-chars-list) |
diff --git a/lisp/net/zone-mode.el b/lisp/obsolete/zone-mode.el index 441ef143f9c..d8bfefc1e87 100644 --- a/lisp/net/zone-mode.el +++ b/lisp/obsolete/zone-mode.el | |||
| @@ -64,7 +64,6 @@ | |||
| 64 | (error "Serial numbers want to move backwards from %s to %s" old-serial new-serial) | 64 | (error "Serial numbers want to move backwards from %s to %s" old-serial new-serial) |
| 65 | (replace-match (concat cur-date new-seq old-flag) t t)))))) | 65 | (replace-match (concat cur-date new-seq old-flag) t t)))))) |
| 66 | 66 | ||
| 67 | ;;;###autoload | ||
| 68 | (defun zone-mode-update-serial-hook () | 67 | (defun zone-mode-update-serial-hook () |
| 69 | "Update the serial number in a zone if the file was modified." | 68 | "Update the serial number in a zone if the file was modified." |
| 70 | (interactive) | 69 | (interactive) |
| @@ -82,7 +81,6 @@ | |||
| 82 | (modify-syntax-entry ?\; "<" zone-mode-syntax-table) | 81 | (modify-syntax-entry ?\; "<" zone-mode-syntax-table) |
| 83 | (modify-syntax-entry ?\n ">" zone-mode-syntax-table)) | 82 | (modify-syntax-entry ?\n ">" zone-mode-syntax-table)) |
| 84 | 83 | ||
| 85 | ;;;###autoload | ||
| 86 | (define-derived-mode zone-mode fundamental-mode "zone" | 84 | (define-derived-mode zone-mode fundamental-mode "zone" |
| 87 | "A mode for editing DNS zone files. | 85 | "A mode for editing DNS zone files. |
| 88 | 86 | ||
diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el index a323d4c4468..78be0f888a3 100644 --- a/lisp/textmodes/dns-mode.el +++ b/lisp/textmodes/dns-mode.el | |||
| @@ -90,6 +90,18 @@ | |||
| 90 | :type 'sexp | 90 | :type 'sexp |
| 91 | :group 'dns-mode) | 91 | :group 'dns-mode) |
| 92 | 92 | ||
| 93 | (defcustom dns-mode-soa-auto-increment-serial t | ||
| 94 | "Whether to increment the SOA serial number automatically. | ||
| 95 | |||
| 96 | If this variable is t, the serial number is incremented upon each save of | ||
| 97 | the file. If it is `ask', Emacs asks for confirmation whether it should | ||
| 98 | increment the serial upon saving. If nil, serials must be incremented | ||
| 99 | manually with \\[dns-mode-soa-increment-serial]." | ||
| 100 | :type '(choice (const :tag "Always" t) | ||
| 101 | (const :tag "Ask" ask) | ||
| 102 | (const :tag "Never" nil)) | ||
| 103 | :group 'dns-mode) | ||
| 104 | |||
| 93 | ;; Syntax table. | 105 | ;; Syntax table. |
| 94 | 106 | ||
| 95 | (defvar dns-mode-syntax-table | 107 | (defvar dns-mode-syntax-table |
| @@ -135,8 +147,12 @@ Turning on DNS mode runs `dns-mode-hook'." | |||
| 135 | (unless (featurep 'xemacs) | 147 | (unless (featurep 'xemacs) |
| 136 | (set (make-local-variable 'font-lock-defaults) | 148 | (set (make-local-variable 'font-lock-defaults) |
| 137 | '(dns-mode-font-lock-keywords nil nil ((?_ . "w"))))) | 149 | '(dns-mode-font-lock-keywords nil nil ((?_ . "w"))))) |
| 150 | (add-hook 'write-contents-functions 'dns-mode-soa-maybe-increment-serial | ||
| 151 | nil t) | ||
| 138 | (easy-menu-add dns-mode-menu dns-mode-map)) | 152 | (easy-menu-add dns-mode-menu dns-mode-map)) |
| 139 | 153 | ||
| 154 | ;;;###autoload (defalias 'zone-mode 'dns-mode) | ||
| 155 | |||
| 140 | ;; Tools. | 156 | ;; Tools. |
| 141 | 157 | ||
| 142 | ;;;###autoload | 158 | ;;;###autoload |
| @@ -192,6 +208,19 @@ Turning on DNS mode runs `dns-mode-hook'." | |||
| 192 | (message "Replaced old serial %s with %s" serial new)) | 208 | (message "Replaced old serial %s with %s" serial new)) |
| 193 | (error "Cannot locate serial number in SOA record")))))) | 209 | (error "Cannot locate serial number in SOA record")))))) |
| 194 | 210 | ||
| 211 | (defun dns-mode-soa-maybe-increment-serial () | ||
| 212 | "Increment SOA serial if needed. | ||
| 213 | |||
| 214 | This function is run from `write-contents-functions'." | ||
| 215 | (when (and (buffer-modified-p) | ||
| 216 | dns-mode-soa-auto-increment-serial | ||
| 217 | (or (eq dns-mode-soa-auto-increment-serial t) | ||
| 218 | (y-or-n-p "Increment SOA serial? "))) | ||
| 219 | ;; We must return nil. If `dns-mode-soa-increment-serial' signals | ||
| 220 | ;; an error saving will fail but that probably means that the | ||
| 221 | ;; serial should be fixed to comply with the RFC anyway! -rfr | ||
| 222 | (progn (dns-mode-soa-increment-serial) nil))) | ||
| 223 | |||
| 195 | ;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode)) | 224 | ;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode)) |
| 196 | 225 | ||
| 197 | (provide 'dns-mode) | 226 | (provide 'dns-mode) |