aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/obsolete
diff options
context:
space:
mode:
authorRomain Francoise2006-08-11 15:42:48 +0000
committerRomain Francoise2006-08-11 15:42:48 +0000
commit946c199400a4eb2fa4a2d0889f1a6db5cb812a44 (patch)
tree944918041effea13a9dbc0dd6c1e00fd1aba94e8 /lisp/obsolete
parent08eedb79230d76e2faa005e8c343f744d0489a33 (diff)
downloademacs-946c199400a4eb2fa4a2d0889f1a6db5cb812a44.tar.gz
emacs-946c199400a4eb2fa4a2d0889f1a6db5cb812a44.zip
Delete zone-mode.el.
Diffstat (limited to 'lisp/obsolete')
-rw-r--r--lisp/obsolete/zone-mode.el118
1 files changed, 0 insertions, 118 deletions
diff --git a/lisp/obsolete/zone-mode.el b/lisp/obsolete/zone-mode.el
deleted file mode 100644
index d8bfefc1e87..00000000000
--- a/lisp/obsolete/zone-mode.el
+++ /dev/null
@@ -1,118 +0,0 @@
1;;; zone-mode.el --- major mode for editing DNS zone files
2
3;; Copyright (C) 1998, 2002, 2003, 2004, 2005,
4;; 2006 Free Software Foundation, Inc.
5
6;; Author: John Heidemann <johnh@isi.edu>
7;; Keywords: DNS, languages
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation; either version 2, or (at your option)
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
25
26;;; Commentary:
27
28;;;
29;;; See the comments in ``define-derived-mode zone-mode''
30;;; (the last function in this file)
31;;; for what this mode is and how to use it automatically.
32;;;
33
34;;;
35;;; Credits:
36;;; Zone-mode was written by John Heidemann <johnh@isi.edu>,
37;;; with bug fixes from Simon Leinen <simon@limmat.switch.ch>.
38;;;
39
40;;; Code:
41
42(defun zone-mode-update-serial ()
43 "Update the serial number in a zone."
44 (interactive)
45 (save-excursion
46 (goto-char (point-min))
47 (while (re-search-forward "\\b\\([0-9]+\\)\\([0-9][0-9]\\)\\([ \t]+;[ \t]+[Ss]erial\\)" (point-max) t)
48 (let* ((old-date (match-string 1))
49 (old-seq (match-string 2))
50 (old-seq-num (string-to-number (match-string 2)))
51 (old-flag (match-string 3))
52 (cur-date (format-time-string "%Y%m%d"))
53 (new-seq
54 (cond
55 ((not (string= old-date cur-date))
56 "00") ;; reset sequence number
57 ((>= old-seq-num 99)
58 (error "Serial number's sequence cannot increment beyond 99"))
59 (t
60 (format "%02d" (1+ old-seq-num)))))
61 (old-serial (concat old-date old-seq))
62 (new-serial (concat cur-date new-seq)))
63 (if (string-lessp new-serial old-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))))))
66
67(defun zone-mode-update-serial-hook ()
68 "Update the serial number in a zone if the file was modified."
69 (interactive)
70 (if (buffer-modified-p (current-buffer))
71 (zone-mode-update-serial))
72 nil ;; so we can run from write-file-hooks
73 )
74
75(defvar zone-mode-syntax-table nil
76 "Zone-mode's syntax table.")
77
78(defun zone-mode-load-time-setup ()
79 "Initialize `zone-mode' stuff."
80 (setq zone-mode-syntax-table (make-syntax-table))
81 (modify-syntax-entry ?\; "<" zone-mode-syntax-table)
82 (modify-syntax-entry ?\n ">" zone-mode-syntax-table))
83
84(define-derived-mode zone-mode fundamental-mode "zone"
85 "A mode for editing DNS zone files.
86
87Zone-mode does two things:
88
89 - automatically update the serial number for a zone
90 when saving the file
91
92 - fontification"
93
94 (add-hook 'write-file-functions 'zone-mode-update-serial-hook nil t)
95
96 (if (null zone-mode-syntax-table)
97 (zone-mode-load-time-setup)) ;; should have been run at load-time
98
99 ;; font-lock support:
100 (set-syntax-table zone-mode-syntax-table)
101 (make-local-variable 'comment-start)
102 (setq comment-start ";")
103 (make-local-variable 'comment-start-skip)
104 ;; Look within the line for a ; following an even number of backslashes
105 ;; after either a non-backslash or the line beginning.
106 (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*")
107 (make-local-variable 'comment-column)
108 (setq comment-column 40)
109 (make-local-variable 'font-lock-defaults)
110 (setq font-lock-defaults
111 '(nil nil nil nil beginning-of-line)))
112
113(zone-mode-load-time-setup)
114
115(provide 'zone-mode)
116
117;;; arch-tag: 6a2940ef-fd4f-4de7-b979-b027b09821fe
118;;; zone-mode.el ends here