Synch with Emacs trunk.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 28 May 2009 23:16:51 +0000 (23:16 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Thu, 28 May 2009 23:16:51 +0000 (23:16 +0000)
=======================
2009-04-20  Stefan Monnier  <monnier@iro.umontreal.ca>

* rfc2047.el (rfc2047-decode-region): Don't skip past `start', which
could happen if the text is only composed of spaces and/or tabs.

2006-08-10  Romain Francoise  <romain@orebokech.com>

* 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'.

2005-05-27  Lute Kamstra  <lute@gnu.org>

* textmodes/dns-mode.el (dns-mode): Specify customization group.

lisp/ChangeLog
lisp/dns-mode.el
lisp/rfc2047.el

index 8029e4a..1644222 100644 (file)
@@ -3,6 +3,11 @@
        * spam.el: Use dns-query instead of query-dns.  Was renamed on
        2008-12-25 in dns.el.
 
+2009-04-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * rfc2047.el (rfc2047-decode-region): Don't skip past `start', which
+       could happen if the text is only composed of spaces and/or tabs.
+
 2009-03-03  Brian Sniffen  <bts@evenmere.org>  (tiny change)
 
        * gnus-draft.el (gnus-draft-send): Bind gnus-message-setup-hook to nil
        * mm-extern.el (mm-extern-mail-server): End `y-or-n-p' prompt with a
        space.
 
+2006-08-10  Romain Francoise  <romain@orebokech.com>
+
+       * 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'.
+
 2006-08-09  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * compface.el (uncompface): Use binary rather than raw-text-unix.
        * dgnushack.el: Advise byte-optimize-form-code-walker to avoid the
        ``...called for effect'' warnings for Emacs 21.4 as well as 21.3.
 
+2005-05-27  Lute Kamstra  <lute@gnu.org>
+
+       * textmodes/dns-mode.el (dns-mode): Specify customization group.
+
 2005-05-26  Luc Teirlinck  <teirllm@auburn.edu>
 
        * gnus-agent.el (gnus-agent-make-mode-line-string):
index e926d8c..beab676 100644 (file)
@@ -49,7 +49,7 @@
 
 (defgroup dns-mode nil
   "DNS master file mode configuration."
-  :group 'comm)
+  :group 'data)
 
 (defconst dns-mode-classes '("IN" "CS" "CH" "HS")
   "List of strings with known DNS classes.")
   :type 'sexp
   :group 'dns-mode)
 
+(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))
+  :group 'dns-mode)
+
 ;; Syntax table.
 
 (defvar dns-mode-syntax-table
@@ -134,8 +146,12 @@ Turning on DNS mode runs `dns-mode-hook'."
   (unless (featurep 'xemacs)
     (set (make-local-variable 'font-lock-defaults)
         '(dns-mode-font-lock-keywords nil nil ((?_ . "w")))))
+  (add-hook 'before-save-hook 'dns-mode-soa-maybe-increment-serial
+           nil t)
   (easy-menu-add dns-mode-menu dns-mode-map))
 
+;;;###autoload (defalias 'zone-mode 'dns-mode)
+
 ;; Tools.
 
 ;;;###autoload
@@ -191,6 +207,21 @@ Turning on DNS mode runs `dns-mode-hook'."
              (message "Replaced old serial %s with %s" serial new))
          (error "Cannot locate serial number in SOA record"))))))
 
+(defun dns-mode-soa-maybe-increment-serial ()
+  "Increment SOA serial if needed.
+
+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? ")))
+    ;; 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)
+          ;; We return nil in case this is used in write-contents-functions.
+          nil)))
+
 ;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode))
 
 (provide 'dns-mode)
index 6b77464..c0bdec3 100644 (file)
@@ -1045,7 +1045,7 @@ other than `\"' and `\\' in quoted strings."
                (setq start (point))
                (setq quoted (eq (char-after) ?\"))
                (goto-char (point-max))
-               (skip-chars-backward " \t")
+               (skip-chars-backward " \t" start)
                (if (setq quoted (and quoted
                                      (> (point) (1+ start))
                                      (eq (char-before) ?\")))