[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/copyright.el
From: |
Kim F . Storm |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/emacs-lisp/copyright.el |
Date: |
Tue, 01 Mar 2005 05:14:48 -0500 |
Index: emacs/lisp/emacs-lisp/copyright.el
diff -c emacs/lisp/emacs-lisp/copyright.el:1.48
emacs/lisp/emacs-lisp/copyright.el:1.49
*** emacs/lisp/emacs-lisp/copyright.el:1.48 Wed Aug 18 02:11:36 2004
--- emacs/lisp/emacs-lisp/copyright.el Tue Mar 1 10:14:48 2005
***************
*** 178,183 ****
--- 178,218 ----
;;;###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 (make-marker))
+ last)
+ (set-marker e (1+ (match-end 2)))
+ (goto-char s)
+ (while (and (< (point) (marker-position e))
+ (re-search-forward "\\([^0-9]\\)\\([0-9]+\\)[^0-9]"
+ (marker-position e) t))
+ (let ((p (point))
+ (sep (match-string 1))
+ (year (string-to-number (match-string 2))))
+ (goto-char (1+ (match-beginning 0)))
+ (unless (= (char-syntax (string-to-char sep)) ?\s)
+ (insert " "))
+ (if (< year 100)
+ (insert (if (>= year 50) "19" "20")))
+ (goto-char p)
+ (setq last p)))
+ (when last
+ (goto-char last)
+ (let ((fill-prefix " "))
+ (fill-region s last))
+ )
+ (set-marker e nil)
+ (copyright-update nil t))
+ (message "No copyright message")
+ (goto-char (point-min))))
+
+ ;;;###autoload
(define-skeleton copyright
"Insert a copyright by $ORGANIZATION notice at cursor."
"Company: "
- [Emacs-diffs] Changes to emacs/lisp/emacs-lisp/copyright.el,
Kim F . Storm <=