| | 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 | |
|---|
| | 211 | (defun dns-mode-soa-maybe-increment-serial () |
|---|
| | 212 | "Increment SOA serial if needed. |
|---|
| | 213 | |
|---|
| | 214 | This function is run from `before-save-hook'." |
|---|
| | 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 | ;; If `dns-mode-soa-increment-serial' signals an error saving will |
|---|
| | 220 | ;; fail but that probably means that the serial should be fixed to |
|---|
| | 221 | ;; comply with the RFC anyway! -rfr |
|---|
| | 222 | (progn (dns-mode-soa-increment-serial) |
|---|
| | 223 | ;; We return nil in case this is used in write-contents-functions. |
|---|
| | 224 | nil))) |
|---|
| | 225 | |
|---|