changeset 72359:2b576e9ebfa4

(dns-mode): Use before-save-hook.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 11 Aug 2006 13:56:50 +0000
parents eb5f2f6fbcef
children 8cd74611dbf4
files lisp/ChangeLog lisp/textmodes/dns-mode.el
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Aug 11 09:28:44 2006 +0000
+++ b/lisp/ChangeLog	Fri Aug 11 13:56:50 2006 +0000
@@ -1,3 +1,7 @@
+2006-08-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* textmodes/dns-mode.el (dns-mode): Use before-save-hook.
+
 2006-08-11  Thien-Thi Nguyen  <ttn@gnu.org>
 
 	* emacs-lisp/bindat.el (bindat-ip-to-string):
--- a/lisp/textmodes/dns-mode.el	Fri Aug 11 09:28:44 2006 +0000
+++ b/lisp/textmodes/dns-mode.el	Fri Aug 11 13:56:50 2006 +0000
@@ -147,7 +147,7 @@
   (unless (featurep 'xemacs)
     (set (make-local-variable 'font-lock-defaults)
 	 '(dns-mode-font-lock-keywords nil nil ((?_ . "w")))))
-  (add-hook 'write-contents-functions 'dns-mode-soa-maybe-increment-serial
+  (add-hook 'before-save-hook 'dns-mode-soa-maybe-increment-serial
 	    nil t)
   (easy-menu-add dns-mode-menu dns-mode-map))
 
@@ -211,15 +211,17 @@
 (defun dns-mode-soa-maybe-increment-serial ()
   "Increment SOA serial if needed.
 
-This function is run from `write-contents-functions'."
+This function is run from `before-save-hook'."
   (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? ")))
-    ;; We must return nil.  If `dns-mode-soa-increment-serial' signals
+    ;; 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
-    (progn (dns-mode-soa-increment-serial) nil)))
+    (progn (dns-mode-soa-increment-serial)
+           ;; We return nil in case this is used in write-contents-functions.
+           nil)))
 
 ;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode))