diff options
| author | Stefan Monnier | 2006-08-11 13:56:50 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2006-08-11 13:56:50 +0000 |
| commit | aa7adb2ada9a42f088c2edb234248d7e078d19c6 (patch) | |
| tree | c5842fd09c70cc6e93e369dc0a03890447ba7ce0 /lisp | |
| parent | bad03cfc8030793473927dff7f8c87bc45fc4bbe (diff) | |
| download | emacs-aa7adb2ada9a42f088c2edb234248d7e078d19c6.tar.gz emacs-aa7adb2ada9a42f088c2edb234248d7e078d19c6.zip | |
(dns-mode): Use before-save-hook.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/textmodes/dns-mode.el | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a6ee985c659..7bb97d09b86 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2006-08-11 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * textmodes/dns-mode.el (dns-mode): Use before-save-hook. | ||
| 4 | |||
| 1 | 2006-08-11 Thien-Thi Nguyen <ttn@gnu.org> | 5 | 2006-08-11 Thien-Thi Nguyen <ttn@gnu.org> |
| 2 | 6 | ||
| 3 | * emacs-lisp/bindat.el (bindat-ip-to-string): | 7 | * emacs-lisp/bindat.el (bindat-ip-to-string): |
diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el index 78be0f888a3..8ee69f03d7b 100644 --- a/lisp/textmodes/dns-mode.el +++ b/lisp/textmodes/dns-mode.el | |||
| @@ -147,7 +147,7 @@ Turning on DNS mode runs `dns-mode-hook'." | |||
| 147 | (unless (featurep 'xemacs) | 147 | (unless (featurep 'xemacs) |
| 148 | (set (make-local-variable 'font-lock-defaults) | 148 | (set (make-local-variable 'font-lock-defaults) |
| 149 | '(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 | 150 | (add-hook 'before-save-hook 'dns-mode-soa-maybe-increment-serial |
| 151 | nil t) | 151 | nil t) |
| 152 | (easy-menu-add dns-mode-menu dns-mode-map)) | 152 | (easy-menu-add dns-mode-menu dns-mode-map)) |
| 153 | 153 | ||
| @@ -211,15 +211,17 @@ Turning on DNS mode runs `dns-mode-hook'." | |||
| 211 | (defun dns-mode-soa-maybe-increment-serial () | 211 | (defun dns-mode-soa-maybe-increment-serial () |
| 212 | "Increment SOA serial if needed. | 212 | "Increment SOA serial if needed. |
| 213 | 213 | ||
| 214 | This function is run from `write-contents-functions'." | 214 | This function is run from `before-save-hook'." |
| 215 | (when (and (buffer-modified-p) | 215 | (when (and (buffer-modified-p) |
| 216 | dns-mode-soa-auto-increment-serial | 216 | dns-mode-soa-auto-increment-serial |
| 217 | (or (eq dns-mode-soa-auto-increment-serial t) | 217 | (or (eq dns-mode-soa-auto-increment-serial t) |
| 218 | (y-or-n-p "Increment SOA serial? "))) | 218 | (y-or-n-p "Increment SOA serial? "))) |
| 219 | ;; We must return nil. If `dns-mode-soa-increment-serial' signals | 219 | ;; If `dns-mode-soa-increment-serial' signals |
| 220 | ;; an error saving will fail but that probably means that the | 220 | ;; an error saving will fail but that probably means that the |
| 221 | ;; serial should be fixed to comply with the RFC anyway! -rfr | 221 | ;; serial should be fixed to comply with the RFC anyway! -rfr |
| 222 | (progn (dns-mode-soa-increment-serial) nil))) | 222 | (progn (dns-mode-soa-increment-serial) |
| 223 | ;; We return nil in case this is used in write-contents-functions. | ||
| 224 | nil))) | ||
| 223 | 225 | ||
| 224 | ;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode)) | 226 | ;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode)) |
| 225 | 227 | ||