/[emacs]/emacs/lisp/emacs-lisp/copyright.el
ViewVC logotype

Diff of /emacs/lisp/emacs-lisp/copyright.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.40.4.2 by uid65618, Thu Feb 5 14:48:33 2004 UTC revision 1.40.4.3 by miles, Sat Sep 4 09:24:35 2004 UTC
# Line 54  The second \\( \\) construct must match Line 54  The second \\( \\) construct must match
54    :group 'copyright    :group 'copyright
55    :type 'regexp)    :type 'regexp)
56    
57    (defcustom copyright-years-regexp
58     "\\(\\s *\\)\\([1-9]\\([-0-9, ';/*%#\n\t]\\|\\s<\\|\\s>\\)*[0-9]+\\)"
59      "*Match additional copyright notice years.
60    The second \\( \\) construct must match the years."
61      :group 'copyright
62      :type 'regexp)
63    
64    
65  (defcustom copyright-query 'function  (defcustom copyright-query 'function
66    "*If non-nil, ask user before changing copyright.    "*If non-nil, ask user before changing copyright.
# Line 77  When this is `function', only ask when c Line 84  When this is `function', only ask when c
84    
85  (defun copyright-update-year (replace noquery)  (defun copyright-update-year (replace noquery)
86    (when (re-search-forward copyright-regexp (+ (point) copyright-limit) t)    (when (re-search-forward copyright-regexp (+ (point) copyright-limit) t)
87        ;; If the years are continued onto multiple lined
88        ;; that are marked as comments, skip to the end of the years anyway.
89        (while (save-excursion
90                 (and (eq (following-char) ?,)
91                      (progn (forward-char 1) t)
92                      (progn (skip-chars-forward " \t") (eolp))
93                      comment-start-skip
94                      (save-match-data
95                        (forward-line 1)
96                        (and (looking-at comment-start-skip)
97                             (goto-char (match-end 0))))
98                      (save-match-data
99                        (looking-at copyright-years-regexp))))
100          (forward-line 1)
101          (re-search-forward comment-start-skip)
102          (re-search-forward copyright-years-regexp))
103    
104      ;; Note that `current-time-string' isn't locale-sensitive.      ;; Note that `current-time-string' isn't locale-sensitive.
105      (setq copyright-current-year (substring (current-time-string) -4))      (setq copyright-current-year (substring (current-time-string) -4))
106      (unless (string= (buffer-substring (- (match-end 2) 2) (match-end 2))      (unless (string= (buffer-substring (- (match-end 2) 2) (match-end 2))
# Line 100  When this is `function', only ask when c Line 124  When this is `function', only ask when c
124                             (eq (char-after (+ (point) size -2)) ?-)))                             (eq (char-after (+ (point) size -2)) ?-)))
125                    ;; This is a range so just replace the end part.                    ;; This is a range so just replace the end part.
126                    (delete-char size)                    (delete-char size)
                 ;; Detect if this is using the following shorthand:  
                 ;; (C) 1993, 94, 95, 1998, 2000, 01, 02, 2003  
                 (if (and  
                      ;; Check that the last year was 4-chars and same century.  
                      (eq size -4)  
                      (equal (buffer-substring (- (point) 4) (- (point) 2))  
                             (substring copyright-current-year 0 2))  
                      ;; Check that there are 2-char years as well.  
                      (save-excursion  
                        (re-search-backward "[^0-9][0-9][0-9][^0-9]"  
                                            (line-beginning-position) t))  
                      ;; Make sure we don't remove the first century marker.  
                      (save-excursion  
                        (forward-char size)  
                        (re-search-backward  
                         (concat (buffer-substring (point) (+ (point) 2))  
                                 "[0-9][0-9]")  
                         (line-beginning-position) t)))  
                     ;; Remove the century marker of the last entry.  
                     (delete-region (- (point) 4) (- (point) 2)))  
127                  ;; Insert a comma with the preferred number of spaces.                  ;; Insert a comma with the preferred number of spaces.
128                  (insert                  (insert
129                   (save-excursion                   (save-excursion

Legend:
Removed from v.1.40.4.2  
changed lines
  Added in v.1.40.4.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26