diff options
| author | Thien-Thi Nguyen | 2007-08-17 22:06:50 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2007-08-17 22:06:50 +0000 |
| commit | 4168d2c761ffb634147d545cbba3da8d923110ee (patch) | |
| tree | 44e927ee1011bdcb1d8167ddea8e1c02b6548afd | |
| parent | bbe5cceac71e18df96cb25e21f936b4cfe68df01 (diff) | |
| download | emacs-4168d2c761ffb634147d545cbba3da8d923110ee.tar.gz emacs-4168d2c761ffb634147d545cbba3da8d923110ee.zip | |
(copyright-limit): New defsubst.
(copyright-update-year, copyright-update)
(copyright-fix-years): Use it.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/copyright.el | 13 |
2 files changed, 13 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1171fe04c6e..577d1f65a25 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2007-08-17 Thien-Thi Nguyen <ttn@gnuvola.org> | ||
| 2 | |||
| 3 | * emacs-lisp/copyright.el (copyright-limit): New defsubst. | ||
| 4 | (copyright-update-year, copyright-update) | ||
| 5 | (copyright-fix-years): Use it. | ||
| 6 | |||
| 1 | 2007-08-17 Kimit Yada <kimitto@gmail.com> (tiny change) | 7 | 2007-08-17 Kimit Yada <kimitto@gmail.com> (tiny change) |
| 2 | 8 | ||
| 3 | * emacs-lisp/copyright.el (copyright-update-year): | 9 | * emacs-lisp/copyright.el (copyright-update-year): |
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index 84f96b12ad5..fc6ff213c6f 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el | |||
| @@ -90,15 +90,17 @@ When this is `function', only ask when called non-interactively." | |||
| 90 | (defvar copyright-current-year (substring (current-time-string) -4) | 90 | (defvar copyright-current-year (substring (current-time-string) -4) |
| 91 | "String representing the current year.") | 91 | "String representing the current year.") |
| 92 | 92 | ||
| 93 | (defsubst copyright-limit () ; re-search-forward BOUND | ||
| 94 | (or (not copyright-limit) | ||
| 95 | (+ (point) copyright-limit))) | ||
| 96 | |||
| 93 | (defun copyright-update-year (replace noquery) | 97 | (defun copyright-update-year (replace noquery) |
| 94 | (when | 98 | (when |
| 95 | (condition-case err | 99 | (condition-case err |
| 96 | (re-search-forward (concat "\\(" copyright-regexp | 100 | (re-search-forward (concat "\\(" copyright-regexp |
| 97 | "\\)\\([ \t]*\n\\)?.*\\(?:" | 101 | "\\)\\([ \t]*\n\\)?.*\\(?:" |
| 98 | copyright-names-regexp "\\)") | 102 | copyright-names-regexp "\\)") |
| 99 | (if copyright-limit | 103 | (copyright-limit) |
| 100 | (+ (point) copyright-limit) | ||
| 101 | t) | ||
| 102 | t) | 104 | t) |
| 103 | ;; In case the regexp is rejected. This is useful because | 105 | ;; In case the regexp is rejected. This is useful because |
| 104 | ;; copyright-update is typically called from before-save-hook where | 106 | ;; copyright-update is typically called from before-save-hook where |
| @@ -184,7 +186,7 @@ interactively." | |||
| 184 | "\\(the Free Software Foundation;\ | 186 | "\\(the Free Software Foundation;\ |
| 185 | either \\|; a\\^u eldono \\([0-9]+\\)a, ? a\\^u (la\\^u via \\)\ | 187 | either \\|; a\\^u eldono \\([0-9]+\\)a, ? a\\^u (la\\^u via \\)\ |
| 186 | version \\([0-9]+\\), or (at" | 188 | version \\([0-9]+\\), or (at" |
| 187 | (if copyright-limit (+ (point) copyright-limit)) t) | 189 | (copyright-limit) t) |
| 188 | (not (string= (match-string 3) copyright-current-gpl-version)) | 190 | (not (string= (match-string 3) copyright-current-gpl-version)) |
| 189 | (or noquery | 191 | (or noquery |
| 190 | (y-or-n-p (concat "Replace GPL version by " | 192 | (y-or-n-p (concat "Replace GPL version by " |
| @@ -206,8 +208,7 @@ Uses heuristic: year >= 50 means 19xx, < 50 means 20xx." | |||
| 206 | (interactive) | 208 | (interactive) |
| 207 | (widen) | 209 | (widen) |
| 208 | (goto-char (point-min)) | 210 | (goto-char (point-min)) |
| 209 | (if (re-search-forward copyright-regexp | 211 | (if (re-search-forward copyright-regexp (copyright-limit) t) |
| 210 | (if copyright-limit (+ (point) copyright-limit)) t) | ||
| 211 | (let ((s (match-beginning 2)) | 212 | (let ((s (match-beginning 2)) |
| 212 | (e (copy-marker (1+ (match-end 2)))) | 213 | (e (copy-marker (1+ (match-end 2)))) |
| 213 | (p (make-marker)) | 214 | (p (make-marker)) |