# HG changeset patch # User Thien-Thi Nguyen # Date 1187388352 0 # Node ID 7206375cd8a657f05bea4d2a7531cfd41bd96235 # Parent 643ae46953f28997e7809480f50ca6d08d060e77 (copyright-limit): New defsubst. (copyright-update-year, copyright-update) (copyright-fix-years): Use it. diff -r 643ae46953f2 -r 7206375cd8a6 lisp/emacs-lisp/copyright.el --- a/lisp/emacs-lisp/copyright.el Fri Aug 17 21:56:02 2007 +0000 +++ b/lisp/emacs-lisp/copyright.el Fri Aug 17 22:05:52 2007 +0000 @@ -90,15 +90,17 @@ (defvar copyright-current-year (substring (current-time-string) -4) "String representing the current year.") +(defsubst copyright-limit () ; re-search-forward BOUND + (or (not copyright-limit) + (+ (point) copyright-limit))) + (defun copyright-update-year (replace noquery) (when (condition-case err (re-search-forward (concat "\\(" copyright-regexp "\\)\\([ \t]*\n\\)?.*\\(?:" copyright-names-regexp "\\)") - (if copyright-limit - (+ (point) copyright-limit) - t) + (copyright-limit) t) ;; In case the regexp is rejected. This is useful because ;; copyright-update is typically called from before-save-hook where @@ -184,7 +186,7 @@ "\\(the Free Software Foundation;\ either \\|; a\\^u eldono \\([0-9]+\\)a, ? a\\^u (la\\^u via \\)\ version \\([0-9]+\\), or (at" - (if copyright-limit (+ (point) copyright-limit)) t) + (copyright-limit) t) (not (string= (match-string 3) copyright-current-gpl-version)) (or noquery (y-or-n-p (concat "Replace GPL version by " @@ -206,8 +208,7 @@ (interactive) (widen) (goto-char (point-min)) - (if (re-search-forward copyright-regexp - (if copyright-limit (+ (point) copyright-limit)) t) + (if (re-search-forward copyright-regexp (copyright-limit) t) (let ((s (match-beginning 2)) (e (copy-marker (1+ (match-end 2)))) (p (make-marker))