summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/copyright.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2005-03-03 10:35:22 +0000
committerMiles Bader <miles@gnu.org>2005-03-03 10:35:22 +0000
commitdedb5504d3464bd50b6c591d36791c5535af68c1 (patch)
tree83ce1054c597d5e7c0d9be5dffd1d08dae2e330c /lisp/emacs-lisp/copyright.el
parentc638e2237cd90a294ed01ae2d29a51e25887bd43 (diff)
parent139c65cf7b6b0bce5f4cd6e45f450ff4f02d5421 (diff)
downloademacs-dedb5504d3464bd50b6c591d36791c5535af68c1.tar.gz
emacs-dedb5504d3464bd50b6c591d36791c5535af68c1.tar.bz2
emacs-dedb5504d3464bd50b6c591d36791c5535af68c1.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-21
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0 (patch 129-149) - Update from CVS - Merge from gnus--rel--5.10 - (make-text-button): Default button type if not specified - quick-install-emacs: Use mkdir --verbose only when requested * miles@gnu.org--gnu-2005/gnus--rel--5.10 (patch 31-33) - Merge from emacs--cvs-trunk--0 - Update from CVS
Diffstat (limited to 'lisp/emacs-lisp/copyright.el')
-rw-r--r--lisp/emacs-lisp/copyright.el37
1 files changed, 36 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index a79e53b7dd4..a37dfac9e9a 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -1,6 +1,6 @@
;;; copyright.el --- update the copyright notice in current buffer
-;; Copyright (C) 1991, 92, 93, 94, 95, 1998, 2001, 2003, 2004
+;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1998, 2001, 2003, 2004, 2005
;; Free Software Foundation, Inc.
;; Author: Daniel Pfeiffer <occitan@esperanto.org>
@@ -176,6 +176,41 @@ version \\([0-9]+\\), or (at"
;;;###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: "