aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/copyright.el35
1 files changed, 35 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index 3d160f54606..dcb68188383 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -178,6 +178,41 @@ version \\([0-9]+\\), or (at"
178 178
179 179
180;;;###autoload 180;;;###autoload
181(defun copyright-fix-years ()
182 "Convert 2 digit years to 4 digit years.
183Uses heuristic: year >= 50 means 19xx, < 50 means 20xx."
184 (interactive)
185 (widen)
186 (goto-char (point-min))
187 (if (re-search-forward copyright-regexp (+ (point) copyright-limit) t)
188 (let ((s (match-beginning 2)) (e (make-marker))
189 last)
190 (set-marker e (1+ (match-end 2)))
191 (goto-char s)
192 (while (and (< (point) (marker-position e))
193 (re-search-forward "\\([^0-9]\\)\\([0-9]+\\)[^0-9]"
194 (marker-position e) t))
195 (let ((p (point))
196 (sep (match-string 1))
197 (year (string-to-number (match-string 2))))
198 (goto-char (1+ (match-beginning 0)))
199 (unless (= (char-syntax (string-to-char sep)) ?\s)
200 (insert " "))
201 (if (< year 100)
202 (insert (if (>= year 50) "19" "20")))
203 (goto-char p)
204 (setq last p)))
205 (when last
206 (goto-char last)
207 (let ((fill-prefix " "))
208 (fill-region s last))
209 )
210 (set-marker e nil)
211 (copyright-update nil t))
212 (message "No copyright message")
213 (goto-char (point-min))))
214
215;;;###autoload
181(define-skeleton copyright 216(define-skeleton copyright
182 "Insert a copyright by $ORGANIZATION notice at cursor." 217 "Insert a copyright by $ORGANIZATION notice at cursor."
183 "Company: " 218 "Company: "