diff options
author | Richard M. Stallman <rms@gnu.org> | 2004-08-16 22:43:09 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2004-08-16 22:43:09 +0000 |
commit | 693118160404cef460e0db29953176d67a8aa29a (patch) | |
tree | b1aa60c76fd377f0f0fa5e7bcc91081568d8e0e6 /lisp/emacs-lisp/copyright.el | |
parent | 35985318379a1fe30f91fb797757ea722f402b3e (diff) | |
download | emacs-693118160404cef460e0db29953176d67a8aa29a.tar.gz emacs-693118160404cef460e0db29953176d67a8aa29a.tar.bz2 emacs-693118160404cef460e0db29953176d67a8aa29a.zip |
(copyright-years-regexp): New variable.
(copyright-update-year): Detect continuation of list of years.
Diffstat (limited to 'lisp/emacs-lisp/copyright.el')
-rw-r--r-- | lisp/emacs-lisp/copyright.el | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index 6a95c60f859..4ed82d22239 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el @@ -54,6 +54,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. @@ -77,6 +84,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)) |