emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copyright.el


From: Richard Stallman
Subject: Re: copyright.el
Date: Sat, 31 Jul 2004 23:31:30 -0400

    There is an apparent bug in copyright.el.

    variables.texi contains:

Does this give good results?

*** copyright.el        07 Jan 2004 08:15:08 -0500      1.46
--- copyright.el        31 Jul 2004 21:04:36 -0400      
***************
*** 54,59 ****
--- 54,66 ----
    :group 'copyright
    :type 'regexp)
  
+ (defcustom copyright-years-regexp
+  "\\(\\s *\\)\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
+   "*Match additional copyright notice years.
+ The second \\( \\) construct must match the years."
+   :group 'copyright
+   :type 'regexp)
+ 
  
  (defcustom copyright-query 'function
    "*If non-nil, ask user before changing copyright.
***************
*** 77,82 ****
--- 84,106 ----
  
  (defun copyright-update-year (replace noquery)
    (when (re-search-forward copyright-regexp (+ (point) copyright-limit) t)
+     ;; If the years are continued onto multiple lined
+     ;; that are marked as comments, skip to the end of the years anyway.
+     (while (save-excursion
+            (and (eq (following-char) ?,)
+                 (progn (forward-char 1) t)
+                 (progn (skip-chars-forward " \t") (eolp))
+                 comment-start-skip
+                 (save-match-data
+                   (forward-line 1)
+                   (and (looking-at comment-start-skip)
+                        (goto-char (match-end 0))))
+                 (save-match-data
+                   (looking-at copyright-years-regexp))))
+       (forward-line 1)
+       (re-search-forward comment-start-skip)
+       (re-search-forward copyright-years-regexp))
+                 
      ;; Note that `current-time-string' isn't locale-sensitive.
      (setq copyright-current-year (substring (current-time-string) -4))
      (unless (string= (buffer-substring (- (match-end 2) 2) (match-end 2))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]