1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-27 07:41:28 -08:00

(copyright-current-year): Now a defvar.

(copyright, copyright-update): Compute the current year at run
time.
This commit is contained in:
Eli Zaretskii 2001-01-08 16:00:38 +00:00
parent 962116cf6f
commit b7812d3050
2 changed files with 14 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2001-01-08 Eli Zaretskii <eliz@is.elta.co.il>
* emacs-lisp/copyright.el (copyright-current-year): Now a defvar.
(copyright, copyright-update): Compute the current year at run
time.
2001-01-08 Gerd Moellmann <gerd@gnu.org> 2001-01-08 Gerd Moellmann <gerd@gnu.org>
* isearch.el (isearch-old-signal-hook): Removed. * isearch.el (isearch-old-signal-hook): Removed.

View file

@ -61,16 +61,18 @@ When this is `function', only ask when called non-interactively."
(other :tag "Ask" t))) (other :tag "Ask" t)))
(defconst copyright-current-year (substring (current-time-string) -4)
"String representing the current year.")
;; when modifying this, also modify the comment generated by autoinsert.el ;; when modifying this, also modify the comment generated by autoinsert.el
(defconst copyright-current-gpl-version "2" (defconst copyright-current-gpl-version "2"
"String representing the current version of the GPL or `nil'.") "String representing the current version of the GPL or `nil'.")
(defvar copyright-update t) (defvar copyright-update t)
;; This is a defvar rather than a defconst, because the year can
;; change during the Emacs session.
(defvar copyright-current-year "2001"
"String representing the current year.")
;;;###autoload ;;;###autoload
(defun copyright-update (&optional arg) (defun copyright-update (&optional arg)
"Update the copyright notice at the beginning of the buffer to indicate "Update the copyright notice at the beginning of the buffer to indicate
@ -84,6 +86,7 @@ copyright, if any, are updated as well."
(save-restriction (save-restriction
(widen) (widen)
(goto-char (point-min)) (goto-char (point-min))
(setq copyright-current-year (substring (current-time-string) -4))
(if (re-search-forward copyright-regexp copyright-limit t) (if (re-search-forward copyright-regexp copyright-limit t)
(if (string= (buffer-substring (- (match-end 2) 2) (match-end 2)) (if (string= (buffer-substring (- (match-end 2) 2) (match-end 2))
(substring copyright-current-year -2)) (substring copyright-current-year -2))
@ -148,7 +151,7 @@ copyright, if any, are updated as well."
"Insert a copyright by $ORGANIZATION notice at cursor." "Insert a copyright by $ORGANIZATION notice at cursor."
"Company: " "Company: "
comment-start comment-start
"Copyright (C) " copyright-current-year " by " "Copyright (C) " `(substring (current-time-string) -4) " by "
(or (getenv "ORGANIZATION") (or (getenv "ORGANIZATION")
str) str)
'(if (> (point) copyright-limit) '(if (> (point) copyright-limit)