+;;;###autoload
+(defun copyright-fix-years ()
+ "Convert 2 digit years to 4 digit years.
+Uses heuristic: year >= 50 means 19xx, < 50 means 20xx."
+ (interactive)
+ (widen)
+ (goto-char (point-min))
+ (if (re-search-forward copyright-regexp (+ (point) copyright-limit) t)
+ (let ((s (match-beginning 2))
+ (e (copy-marker (1+ (match-end 2))))
+ (p (make-marker))
+ last)
+ (goto-char s)
+ (while (re-search-forward "[0-9]+" e t)
+ (set-marker p (point))
+ (goto-char (match-beginning 0))
+ (let ((sep (char-before))
+ (year (string-to-number (match-string 0))))
+ (when (and sep
+ (/= (char-syntax sep) ?\s)
+ (/= sep ?-))
+ (insert " "))
+ (when (< year 100)
+ (insert (if (>= year 50) "19" "20"))))
+ (goto-char p)
+ (setq last p))
+ (when last
+ (goto-char last)
+ ;; Don't mess up whitespace after the years.
+ (skip-chars-backward " \t")
+ (save-restriction
+ (narrow-to-region (point-min) (point))
+ (let ((fill-prefix " "))
+ (fill-region s last))))
+ (set-marker e nil)
+ (set-marker p nil)
+ (copyright-update nil t))
+ (message "No copyright message")))
+