diff options
| author | Stefan Monnier | 2007-07-29 20:11:25 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-07-29 20:11:25 +0000 |
| commit | 463dca7e44715219fe720858d2144d54ea315635 (patch) | |
| tree | 6b404a157942a89467e00273891cfc365f3fc427 | |
| parent | 0b3ef4f1e577e614026f21e4f936b09ec3826cf5 (diff) | |
| download | emacs-463dca7e44715219fe720858d2144d54ea315635.tar.gz emacs-463dca7e44715219fe720858d2144d54ea315635.zip | |
(copyright-update-year, copyright-update, copyright-fix-years, copyright):
Correctly handle the case where copyright-limit is nil.
| -rw-r--r-- | lisp/ChangeLog | 16 | ||||
| -rw-r--r-- | lisp/emacs-lisp/copyright.el | 23 |
2 files changed, 24 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9a1178c1f98..6a74584fbd4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,4 +1,10 @@ | |||
| 1 | 2007-07-28 Novitsky, Konstantin <knovitsk@Bear.com> (tiny change) | 1 | 2007-07-29 Kimit Yada <kimitto@gmail.com> (tiny change) |
| 2 | |||
| 3 | * emacs-lisp/copyright.el (copyright-update-year, copyright-update) | ||
| 4 | (copyright-fix-years, copyright): Correctly handle the case where | ||
| 5 | copyright-limit is nil. | ||
| 6 | |||
| 7 | 2007-07-28 Konstantin Novitsky <knovitsk@Bear.com> (tiny change) | ||
| 2 | 8 | ||
| 3 | * progmodes/python.el (run-python): Fix path separator under w32. | 9 | * progmodes/python.el (run-python): Fix path separator under w32. |
| 4 | 10 | ||
| @@ -9,12 +15,12 @@ | |||
| 9 | 2007-07-28 Alan Mackenzie <acm@muc.de> | 15 | 2007-07-28 Alan Mackenzie <acm@muc.de> |
| 10 | 16 | ||
| 11 | Fix problem with modes derived from CC Mode: | 17 | Fix problem with modes derived from CC Mode: |
| 12 | * progmodes/cc-mode.el (c-make-emacs-variables-local): move this | 18 | * progmodes/cc-mode.el (c-make-emacs-variables-local): Move this |
| 13 | macro to cc-langs. | 19 | macro to cc-langs. |
| 14 | (c-init-language-vars-for): remove call to above macro. | 20 | (c-init-language-vars-for): Remove call to above macro. |
| 15 | * progmodes/cc-langs.el (c-make-emacs-variables-local): macro has | 21 | * progmodes/cc-langs.el (c-make-emacs-variables-local): Macro has |
| 16 | been moved to here. | 22 | been moved to here. |
| 17 | (c-make-init-lang-vars-fun): call c-make-emacs-variables-local. | 23 | (c-make-init-lang-vars-fun): Call c-make-emacs-variables-local. |
| 18 | 24 | ||
| 19 | 2007-07-28 Eli Zaretskii <eliz@gnu.org> | 25 | 2007-07-28 Eli Zaretskii <eliz@gnu.org> |
| 20 | 26 | ||
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index cf6dcdcc166..ed1d01023fb 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el | |||
| @@ -37,7 +37,7 @@ | |||
| 37 | :group 'tools) | 37 | :group 'tools) |
| 38 | 38 | ||
| 39 | (defcustom copyright-limit 2000 | 39 | (defcustom copyright-limit 2000 |
| 40 | "*Don't try to update copyright beyond this position unless interactive. | 40 | "Don't try to update copyright beyond this position unless interactive. |
| 41 | A value of nil means to search whole buffer." | 41 | A value of nil means to search whole buffer." |
| 42 | :group 'copyright | 42 | :group 'copyright |
| 43 | :type '(choice (integer :tag "Limit") | 43 | :type '(choice (integer :tag "Limit") |
| @@ -49,21 +49,21 @@ A value of nil means to search whole buffer." | |||
| 49 | "\\([]\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\ | 49 | "\\([]\\|@copyright{}\\|[Cc]opyright\\s *:?\\s *\\(?:(C)\\)?\ |
| 50 | \\|[Cc]opyright\\s *:?\\s *[]\\)\ | 50 | \\|[Cc]opyright\\s *:?\\s *[]\\)\ |
| 51 | \\s *\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)" | 51 | \\s *\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)" |
| 52 | "*What your copyright notice looks like. | 52 | "What your copyright notice looks like. |
| 53 | The second \\( \\) construct must match the years." | 53 | The second \\( \\) construct must match the years." |
| 54 | :group 'copyright | 54 | :group 'copyright |
| 55 | :type 'regexp) | 55 | :type 'regexp) |
| 56 | 56 | ||
| 57 | (defcustom copyright-years-regexp | 57 | (defcustom copyright-years-regexp |
| 58 | "\\(\\s *\\)\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)" | 58 | "\\(\\s *\\)\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)" |
| 59 | "*Match additional copyright notice years. | 59 | "Match additional copyright notice years. |
| 60 | The second \\( \\) construct must match the years." | 60 | The second \\( \\) construct must match the years." |
| 61 | :group 'copyright | 61 | :group 'copyright |
| 62 | :type 'regexp) | 62 | :type 'regexp) |
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | (defcustom copyright-query 'function | 65 | (defcustom copyright-query 'function |
| 66 | "*If non-nil, ask user before changing copyright. | 66 | "If non-nil, ask user before changing copyright. |
| 67 | When this is `function', only ask when called non-interactively." | 67 | When this is `function', only ask when called non-interactively." |
| 68 | :group 'copyright | 68 | :group 'copyright |
| 69 | :type '(choice (const :tag "Do not ask") | 69 | :type '(choice (const :tag "Do not ask") |
| @@ -83,7 +83,8 @@ When this is `function', only ask when called non-interactively." | |||
| 83 | "String representing the current year.") | 83 | "String representing the current year.") |
| 84 | 84 | ||
| 85 | (defun copyright-update-year (replace noquery) | 85 | (defun copyright-update-year (replace noquery) |
| 86 | (when (re-search-forward copyright-regexp (+ (point) copyright-limit) t) | 86 | (when (re-search-forward copyright-regexp |
| 87 | (if copyright-limit (+ (point) copyright-limit)) t) | ||
| 87 | ;; If the years are continued onto multiple lined | 88 | ;; If the years are continued onto multiple lined |
| 88 | ;; that are marked as comments, skip to the end of the years anyway. | 89 | ;; that are marked as comments, skip to the end of the years anyway. |
| 89 | (while (save-excursion | 90 | (while (save-excursion |
| @@ -159,10 +160,11 @@ interactively." | |||
| 159 | (and copyright-current-gpl-version | 160 | (and copyright-current-gpl-version |
| 160 | ;; match the GPL version comment in .el files, including the | 161 | ;; match the GPL version comment in .el files, including the |
| 161 | ;; bilingual Esperanto one in two-column, and in texinfo.tex | 162 | ;; bilingual Esperanto one in two-column, and in texinfo.tex |
| 162 | (re-search-forward "\\(the Free Software Foundation;\ | 163 | (re-search-forward |
| 164 | "\\(the Free Software Foundation;\ | ||
| 163 | either \\|; a\\^u eldono \\([0-9]+\\)a, ? a\\^u (la\\^u via \\)\ | 165 | either \\|; a\\^u eldono \\([0-9]+\\)a, ? a\\^u (la\\^u via \\)\ |
| 164 | version \\([0-9]+\\), or (at" | 166 | version \\([0-9]+\\), or (at" |
| 165 | (+ (point) copyright-limit) t) | 167 | (if copyright-limit (+ (point) copyright-limit)) t) |
| 166 | (not (string= (match-string 3) copyright-current-gpl-version)) | 168 | (not (string= (match-string 3) copyright-current-gpl-version)) |
| 167 | (or noquery | 169 | (or noquery |
| 168 | (y-or-n-p (concat "Replace GPL version by " | 170 | (y-or-n-p (concat "Replace GPL version by " |
| @@ -184,7 +186,8 @@ Uses heuristic: year >= 50 means 19xx, < 50 means 20xx." | |||
| 184 | (interactive) | 186 | (interactive) |
| 185 | (widen) | 187 | (widen) |
| 186 | (goto-char (point-min)) | 188 | (goto-char (point-min)) |
| 187 | (if (re-search-forward copyright-regexp (+ (point) copyright-limit) t) | 189 | (if (re-search-forward copyright-regexp |
| 190 | (if copyright-limit (+ (point) copyright-limit)) t) | ||
| 188 | (let ((s (match-beginning 2)) | 191 | (let ((s (match-beginning 2)) |
| 189 | (e (copy-marker (1+ (match-end 2)))) | 192 | (e (copy-marker (1+ (match-end 2)))) |
| 190 | (p (make-marker)) | 193 | (p (make-marker)) |
| @@ -224,7 +227,7 @@ Uses heuristic: year >= 50 means 19xx, < 50 means 20xx." | |||
| 224 | "Copyright (C) " `(substring (current-time-string) -4) " by " | 227 | "Copyright (C) " `(substring (current-time-string) -4) " by " |
| 225 | (or (getenv "ORGANIZATION") | 228 | (or (getenv "ORGANIZATION") |
| 226 | str) | 229 | str) |
| 227 | '(if (> (point) (+ (point-min) copyright-limit)) | 230 | '(if (and copyright-limit (> (point) (+ (point-min) copyright-limit))) |
| 228 | (message "Copyright extends beyond `copyright-limit' and won't be updated automatically.")) | 231 | (message "Copyright extends beyond `copyright-limit' and won't be updated automatically.")) |
| 229 | comment-end \n) | 232 | comment-end \n) |
| 230 | 233 | ||
| @@ -235,5 +238,5 @@ Uses heuristic: year >= 50 means 19xx, < 50 means 20xx." | |||
| 235 | ;; coding: emacs-mule | 238 | ;; coding: emacs-mule |
| 236 | ;; End: | 239 | ;; End: |
| 237 | 240 | ||
| 238 | ;;; arch-tag: b4991afb-b6b1-4590-bebe-e076d9d4aee8 | 241 | ;; arch-tag: b4991afb-b6b1-4590-bebe-e076d9d4aee8 |
| 239 | ;;; copyright.el ends here | 242 | ;;; copyright.el ends here |