]> git.eshelyaron.com Git - emacs.git/commitdiff
(copyright-limit): New defsubst.
authorThien-Thi Nguyen <ttn@gnuvola.org>
Fri, 17 Aug 2007 22:06:50 +0000 (22:06 +0000)
committerThien-Thi Nguyen <ttn@gnuvola.org>
Fri, 17 Aug 2007 22:06:50 +0000 (22:06 +0000)
(copyright-update-year, copyright-update)
(copyright-fix-years): Use it.

lisp/ChangeLog
lisp/emacs-lisp/copyright.el

index 1171fe04c6ea01eb0d0e1e7fc2162461a125d822..577d1f65a25516f069bce54749104a4baf960024 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-17  Thien-Thi Nguyen  <ttn@gnuvola.org>
+
+       * emacs-lisp/copyright.el (copyright-limit): New defsubst.
+       (copyright-update-year, copyright-update)
+       (copyright-fix-years): Use it.
+
 2007-08-17  Kimit Yada  <kimitto@gmail.com>  (tiny change)
 
        * emacs-lisp/copyright.el (copyright-update-year):
index 84f96b12ad5ec4497d777d5bd321279ade51ae30..fc6ff213c6ffc81534c51e7ed332edd9773d5468 100644 (file)
@@ -90,15 +90,17 @@ When this is `function', only ask when called non-interactively."
 (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 @@ interactively."
                 "\\(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 @@ Uses heuristic: year >= 50 means 19xx, < 50 means 20xx."
   (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))