summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/copyright.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2004-08-27 07:00:34 +0000
committerMiles Bader <miles@gnu.org>2004-08-27 07:00:34 +0000
commitb71f2b97d343dd5ec39b64b66de86051ee47eb3e (patch)
tree85e3d906c7ba13a3fd447ad054a430388386b748 /lisp/emacs-lisp/copyright.el
parent21b4a4fb21f6254fb37da88b0d5858575f953e22 (diff)
parent11d2e01ba3a82c41eec105df81260568f048e726 (diff)
downloademacs-b71f2b97d343dd5ec39b64b66de86051ee47eb3e.tar.gz
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-32
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-486 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-487 Tweak permissions * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-488 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-489 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-490 Update from CVS: man/fixit.texi (Spelling): Fix typo. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-491 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-494 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-495 Update from CVS: Add missing lisp/mh-e files * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-496 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-499 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-500 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-513 Update from CVS
Diffstat (limited to 'lisp/emacs-lisp/copyright.el')
-rw-r--r--lisp/emacs-lisp/copyright.el44
1 files changed, 24 insertions, 20 deletions
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index 58ab919c2f9..a79e53b7dd4 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -52,6 +52,13 @@ The second \\( \\) construct must match the years."
:group 'copyright
:type 'regexp)
+(defcustom copyright-years-regexp
+ "\\(\\s *\\)\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
+ "*Match additional copyright notice years.
+The second \\( \\) construct must match the years."
+ :group 'copyright
+ :type 'regexp)
+
(defcustom copyright-query 'function
"*If non-nil, ask user before changing copyright.
@@ -75,6 +82,23 @@ When this is `function', only ask when called non-interactively."
(defun copyright-update-year (replace noquery)
(when (re-search-forward copyright-regexp (+ (point) copyright-limit) t)
+ ;; If the years are continued onto multiple lined
+ ;; that are marked as comments, skip to the end of the years anyway.
+ (while (save-excursion
+ (and (eq (following-char) ?,)
+ (progn (forward-char 1) t)
+ (progn (skip-chars-forward " \t") (eolp))
+ comment-start-skip
+ (save-match-data
+ (forward-line 1)
+ (and (looking-at comment-start-skip)
+ (goto-char (match-end 0))))
+ (save-match-data
+ (looking-at copyright-years-regexp))))
+ (forward-line 1)
+ (re-search-forward comment-start-skip)
+ (re-search-forward copyright-years-regexp))
+
;; Note that `current-time-string' isn't locale-sensitive.
(setq copyright-current-year (substring (current-time-string) -4))
(unless (string= (buffer-substring (- (match-end 2) 2) (match-end 2))
@@ -98,26 +122,6 @@ When this is `function', only ask when called non-interactively."
(eq (char-after (+ (point) size -2)) ?-)))
;; This is a range so just replace the end part.
(delete-char size)
- ;; Detect if this is using the following shorthand:
- ;; (C) 1993, 94, 95, 1998, 2000, 01, 02, 2003
- (if (and
- ;; Check that the last year was 4-chars and same century.
- (eq size -4)
- (equal (buffer-substring (- (point) 4) (- (point) 2))
- (substring copyright-current-year 0 2))
- ;; Check that there are 2-char years as well.
- (save-excursion
- (re-search-backward "[^0-9][0-9][0-9][^0-9]"
- (line-beginning-position) t))
- ;; Make sure we don't remove the first century marker.
- (save-excursion
- (forward-char size)
- (re-search-backward
- (concat (buffer-substring (point) (+ (point) 2))
- "[0-9][0-9]")
- (line-beginning-position) t)))
- ;; Remove the century marker of the last entry.
- (delete-region (- (point) 4) (- (point) 2)))
;; Insert a comma with the preferred number of spaces.
(insert
(save-excursion