diff options
| author | Roland McGrath | 1992-06-19 20:17:18 +0000 |
|---|---|---|
| committer | Roland McGrath | 1992-06-19 20:17:18 +0000 |
| commit | 9cfd2eeb81ecf56abdf6d3fdb5c2b89a8d5086b1 (patch) | |
| tree | ba88f7a1a2e4a3126963b9f450c8bf64a9c78d17 | |
| parent | d7c1ec4bd94bf7ab763f40008788df93f564e266 (diff) | |
| download | emacs-9cfd2eeb81ecf56abdf6d3fdb5c2b89a8d5086b1.tar.gz emacs-9cfd2eeb81ecf56abdf6d3fdb5c2b89a8d5086b1.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/emacs-lisp/copyright.el | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index 70f1a43fe54..3d111ba2c7e 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el | |||
| @@ -28,6 +28,10 @@ | |||
| 28 | (defvar replace-copying-with nil | 28 | (defvar replace-copying-with nil |
| 29 | "*If non-nil, replace copying notices with this file.") | 29 | "*If non-nil, replace copying notices with this file.") |
| 30 | 30 | ||
| 31 | (defvar inhibit-update-copyright nil | ||
| 32 | "If nil, ask the user whether or not to update the copyright notice. | ||
| 33 | If the user has said no, we set this to t locally.") | ||
| 34 | |||
| 31 | ;;;###autoload | 35 | ;;;###autoload |
| 32 | (defun update-copyright (&optional replace ask-upd ask-year) | 36 | (defun update-copyright (&optional replace ask-upd ask-year) |
| 33 | "Update the copyright notice at the beginning of the buffer | 37 | "Update the copyright notice at the beginning of the buffer |
| @@ -46,17 +50,22 @@ than adding to it." | |||
| 46 | (save-restriction | 50 | (save-restriction |
| 47 | (widen) | 51 | (widen) |
| 48 | (goto-char (point-min)) | 52 | (goto-char (point-min)) |
| 49 | (if (search-forward current-year nil t) | 53 | ;; Handle abbreviated year lists like "1800, 01, 02, 03". |
| 54 | (if (re-search-forward (concat (substring current-year 0 2) | ||
| 55 | "\\([0-9][0-9]\\(,\\s \\)+\\)*" | ||
| 56 | (substring current-year 2)) | ||
| 57 | nil t) | ||
| 50 | (or ask-upd | 58 | (or ask-upd |
| 51 | (message "Copyright notice already includes %s." current-year)) | 59 | (message "Copyright notice already includes %s." current-year)) |
| 52 | (goto-char (point-min)) | 60 | (goto-char (point-min)) |
| 53 | (if (and (or (not ask-upd) | 61 | (if (and (not inhibit-update-copyright) |
| 62 | (or (not ask-upd) | ||
| 54 | ;; If implicit, narrow it down to things that | 63 | ;; If implicit, narrow it down to things that |
| 55 | ;; look like GPL notices. | 64 | ;; look like GPL notices. |
| 56 | (prog1 | 65 | (prog1 |
| 57 | (search-forward "is free software" nil t) | 66 | (search-forward "is free software" nil t) |
| 58 | (goto-char (point-min)))) | 67 | (goto-char (point-min)))) |
| 59 | (re-search-forward | 68 | (re-search-forward |
| 60 | "[Cc]opyright[^0-9]*\\(\\([-, \t]*\\([0-9]+\\)\\)\\)+" | 69 | "[Cc]opyright[^0-9]*\\(\\([-, \t]*\\([0-9]+\\)\\)\\)+" |
| 61 | nil t) | 70 | nil t) |
| 62 | (or (not ask-upd) | 71 | (or (not ask-upd) |
| @@ -66,7 +75,11 @@ than adding to it." | |||
| 66 | ;; Show the user the copyright. | 75 | ;; Show the user the copyright. |
| 67 | (goto-char (point-min)) | 76 | (goto-char (point-min)) |
| 68 | (sit-for 0) | 77 | (sit-for 0) |
| 69 | (y-or-n-p "Update copyright? "))))) | 78 | (or (y-or-n-p "Update copyright? ") |
| 79 | (progn | ||
| 80 | (set (make-local-variable | ||
| 81 | 'inhibit-update-copyright) t) | ||
| 82 | nil)))))) | ||
| 70 | (progn | 83 | (progn |
| 71 | (setq replace | 84 | (setq replace |
| 72 | (or replace | 85 | (or replace |