52 |
(new-seq |
(new-seq |
53 |
(cond |
(cond |
54 |
((not (string= old-date cur-date)) |
((not (string= old-date cur-date)) |
55 |
"00") ;; reset sequeence number |
"00") ;; reset sequence number |
56 |
((>= old-seq-num 99) |
((>= old-seq-num 99) |
57 |
(error "Serial number's sequenece cannot increment beyond 99")) |
(error "Serial number's sequence cannot increment beyond 99")) |
58 |
(t |
(t |
59 |
(format "%02d" (1+ old-seq-num))))) |
(format "%02d" (1+ old-seq-num))))) |
60 |
(old-serial (concat old-date old-seq)) |
(old-serial (concat old-date old-seq)) |
61 |
(new-serial (concat cur-date new-seq))) |
(new-serial (concat cur-date new-seq))) |
62 |
(if (string-lessp new-serial old-serial) |
(if (string-lessp new-serial old-serial) |
63 |
(error (format "Serial numbers want to move backwards from %s to %s!" old-serial new-serial)) |
(error (format "Serial numbers want to move backwards from %s to %s" old-serial new-serial)) |
64 |
(replace-match (concat cur-date new-seq old-flag) t t)))))) |
(replace-match (concat cur-date new-seq old-flag) t t)))))) |
65 |
|
|
66 |
;;;###autoload |
;;;###autoload |
67 |
(defun zone-mode-update-serial-hook () |
(defun zone-mode-update-serial-hook () |
68 |
"Update the serial number in a zone if the file was modified" |
"Update the serial number in a zone if the file was modified." |
69 |
(interactive) |
(interactive) |
70 |
(if (buffer-modified-p (current-buffer)) |
(if (buffer-modified-p (current-buffer)) |
71 |
(zone-mode-update-serial)) |
(zone-mode-update-serial)) |
76 |
"Zone-mode's syntax table.") |
"Zone-mode's syntax table.") |
77 |
|
|
78 |
(defun zone-mode-load-time-setup () |
(defun zone-mode-load-time-setup () |
79 |
"init zone-mode stuff" |
"Initialise `zone-mode' stuff." |
80 |
(setq zone-mode-syntax-table (make-syntax-table)) |
(setq zone-mode-syntax-table (make-syntax-table)) |
81 |
(modify-syntax-entry ?\; "<" zone-mode-syntax-table) |
(modify-syntax-entry ?\; "<" zone-mode-syntax-table) |
82 |
(modify-syntax-entry ?\n ">" zone-mode-syntax-table)) |
(modify-syntax-entry ?\n ">" zone-mode-syntax-table)) |
92 |
|
|
93 |
- fontification" |
- fontification" |
94 |
|
|
|
(make-local-hook 'write-file-hooks) |
|
95 |
(add-hook 'write-file-hooks 'zone-mode-update-serial-hook) |
(add-hook 'write-file-hooks 'zone-mode-update-serial-hook) |
96 |
|
|
97 |
(if (null zone-mode-syntax-table) |
(if (null zone-mode-syntax-table) |