# HG changeset patch # User Richard M. Stallman # Date 1092696189 0 # Node ID 22f1ac802ffd9a099f968e1e9e392905098c4d19 # Parent 39cc1e82deb16f19ffb9b67cc797a7b82bdd60d8 (copyright-years-regexp): New variable. (copyright-update-year): Detect continuation of list of years. diff -r 39cc1e82deb1 -r 22f1ac802ffd lisp/emacs-lisp/copyright.el --- a/lisp/emacs-lisp/copyright.el Mon Aug 16 22:41:56 2004 +0000 +++ b/lisp/emacs-lisp/copyright.el Mon Aug 16 22:43:09 2004 +0000 @@ -54,6 +54,13 @@ :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. @@ -77,6 +84,23 @@ (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))