diff options
| author | Eli Zaretskii | 2001-01-08 16:00:38 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2001-01-08 16:00:38 +0000 |
| commit | b7812d3050275ecd3184a4c963b58006fedfef66 (patch) | |
| tree | ee7a073e97cbad725bf48ef70cc8fa8d7ec6d49f | |
| parent | 962116cf6fbeae48729fa7aaf56682274634616a (diff) | |
| download | emacs-b7812d3050275ecd3184a4c963b58006fedfef66.tar.gz emacs-b7812d3050275ecd3184a4c963b58006fedfef66.zip | |
(copyright-current-year): Now a defvar.
(copyright, copyright-update): Compute the current year at run
time.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/copyright.el | 13 |
2 files changed, 14 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f1fcdf2e552..a4fe3854cae 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2001-01-08 Eli Zaretskii <eliz@is.elta.co.il> | ||
| 2 | |||
| 3 | * emacs-lisp/copyright.el (copyright-current-year): Now a defvar. | ||
| 4 | (copyright, copyright-update): Compute the current year at run | ||
| 5 | time. | ||
| 6 | |||
| 1 | 2001-01-08 Gerd Moellmann <gerd@gnu.org> | 7 | 2001-01-08 Gerd Moellmann <gerd@gnu.org> |
| 2 | 8 | ||
| 3 | * isearch.el (isearch-old-signal-hook): Removed. | 9 | * isearch.el (isearch-old-signal-hook): Removed. |
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index 8499b815df1..7c06b97269d 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el | |||
| @@ -61,16 +61,18 @@ When this is `function', only ask when called non-interactively." | |||
| 61 | (other :tag "Ask" t))) | 61 | (other :tag "Ask" t))) |
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | (defconst copyright-current-year (substring (current-time-string) -4) | ||
| 65 | "String representing the current year.") | ||
| 66 | |||
| 67 | |||
| 68 | ;; when modifying this, also modify the comment generated by autoinsert.el | 64 | ;; when modifying this, also modify the comment generated by autoinsert.el |
| 69 | (defconst copyright-current-gpl-version "2" | 65 | (defconst copyright-current-gpl-version "2" |
| 70 | "String representing the current version of the GPL or `nil'.") | 66 | "String representing the current version of the GPL or `nil'.") |
| 71 | 67 | ||
| 72 | (defvar copyright-update t) | 68 | (defvar copyright-update t) |
| 73 | 69 | ||
| 70 | ;; This is a defvar rather than a defconst, because the year can | ||
| 71 | ;; change during the Emacs session. | ||
| 72 | (defvar copyright-current-year "2001" | ||
| 73 | "String representing the current year.") | ||
| 74 | |||
| 75 | |||
| 74 | ;;;###autoload | 76 | ;;;###autoload |
| 75 | (defun copyright-update (&optional arg) | 77 | (defun copyright-update (&optional arg) |
| 76 | "Update the copyright notice at the beginning of the buffer to indicate | 78 | "Update the copyright notice at the beginning of the buffer to indicate |
| @@ -84,6 +86,7 @@ copyright, if any, are updated as well." | |||
| 84 | (save-restriction | 86 | (save-restriction |
| 85 | (widen) | 87 | (widen) |
| 86 | (goto-char (point-min)) | 88 | (goto-char (point-min)) |
| 89 | (setq copyright-current-year (substring (current-time-string) -4)) | ||
| 87 | (if (re-search-forward copyright-regexp copyright-limit t) | 90 | (if (re-search-forward copyright-regexp copyright-limit t) |
| 88 | (if (string= (buffer-substring (- (match-end 2) 2) (match-end 2)) | 91 | (if (string= (buffer-substring (- (match-end 2) 2) (match-end 2)) |
| 89 | (substring copyright-current-year -2)) | 92 | (substring copyright-current-year -2)) |
| @@ -148,7 +151,7 @@ copyright, if any, are updated as well." | |||
| 148 | "Insert a copyright by $ORGANIZATION notice at cursor." | 151 | "Insert a copyright by $ORGANIZATION notice at cursor." |
| 149 | "Company: " | 152 | "Company: " |
| 150 | comment-start | 153 | comment-start |
| 151 | "Copyright (C) " copyright-current-year " by " | 154 | "Copyright (C) " `(substring (current-time-string) -4) " by " |
| 152 | (or (getenv "ORGANIZATION") | 155 | (or (getenv "ORGANIZATION") |
| 153 | str) | 156 | str) |
| 154 | '(if (> (point) copyright-limit) | 157 | '(if (> (point) copyright-limit) |