diff options
| -rw-r--r-- | lisp/emacs-lisp/copyright.el | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index 55acb423e7b..b3e0307a519 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el | |||
| @@ -94,6 +94,8 @@ When this is `function', only ask when called non-interactively." | |||
| 94 | (defun copyright-update-year (replace noquery) | 94 | (defun copyright-update-year (replace noquery) |
| 95 | (when | 95 | (when |
| 96 | (condition-case err | 96 | (condition-case err |
| 97 | ;; (1) Need the extra \\( \\) around copyright-regexp because we | ||
| 98 | ;; goto (match-end 1) below. See note (2) below. | ||
| 97 | (re-search-forward (concat "\\(" copyright-regexp | 99 | (re-search-forward (concat "\\(" copyright-regexp |
| 98 | "\\)\\([ \t]*\n\\)?.*\\(?:" | 100 | "\\)\\([ \t]*\n\\)?.*\\(?:" |
| 99 | copyright-names-regexp "\\)") | 101 | copyright-names-regexp "\\)") |
| @@ -104,7 +106,7 @@ When this is `function', only ask when called non-interactively." | |||
| 104 | ;; such an error is very inconvenient for the user. | 106 | ;; such an error is very inconvenient for the user. |
| 105 | (error (message "Can't update copyright: %s" err) nil)) | 107 | (error (message "Can't update copyright: %s" err) nil)) |
| 106 | (goto-char (match-end 1)) | 108 | (goto-char (match-end 1)) |
| 107 | ;; If the years are continued onto multiple lined | 109 | ;; If the years are continued onto multiple lines |
| 108 | ;; that are marked as comments, skip to the end of the years anyway. | 110 | ;; that are marked as comments, skip to the end of the years anyway. |
| 109 | (while (save-excursion | 111 | (while (save-excursion |
| 110 | (and (eq (following-char) ?,) | 112 | (and (eq (following-char) ?,) |
| @@ -119,7 +121,9 @@ When this is `function', only ask when called non-interactively." | |||
| 119 | (looking-at copyright-years-regexp)))) | 121 | (looking-at copyright-years-regexp)))) |
| 120 | (forward-line 1) | 122 | (forward-line 1) |
| 121 | (re-search-forward comment-start-skip) | 123 | (re-search-forward comment-start-skip) |
| 122 | (re-search-forward copyright-years-regexp)) | 124 | ;; (2) Need the extra \\( \\) so that the years are subexp 3, as |
| 125 | ;; they are at note (1) above. | ||
| 126 | (re-search-forward (format "\\(%s\\)" copyright-years-regexp))) | ||
| 123 | 127 | ||
| 124 | ;; Note that `current-time-string' isn't locale-sensitive. | 128 | ;; Note that `current-time-string' isn't locale-sensitive. |
| 125 | (setq copyright-current-year (substring (current-time-string) -4)) | 129 | (setq copyright-current-year (substring (current-time-string) -4)) |
| @@ -132,7 +136,7 @@ When this is `function', only ask when called non-interactively." | |||
| 132 | (concat "Add " copyright-current-year | 136 | (concat "Add " copyright-current-year |
| 133 | " to copyright? ")))) | 137 | " to copyright? ")))) |
| 134 | (if replace | 138 | (if replace |
| 135 | (replace-match copyright-current-year t t nil 2) | 139 | (replace-match copyright-current-year t t nil 3) |
| 136 | (let ((size (save-excursion (skip-chars-backward "0-9")))) | 140 | (let ((size (save-excursion (skip-chars-backward "0-9")))) |
| 137 | (if (and (eq (% (- (string-to-number copyright-current-year) | 141 | (if (and (eq (% (- (string-to-number copyright-current-year) |
| 138 | (string-to-number (buffer-substring | 142 | (string-to-number (buffer-substring |