diff options
author | Miles Bader <miles@gnu.org> | 2005-05-20 04:22:05 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2005-05-20 04:22:05 +0000 |
commit | 64e9342958694825be1664890dcd22fffcd50d3a (patch) | |
tree | a43e1796f5a49ae7eeec671447d10ac3731a1834 /lisp/emacs-lisp/copyright.el | |
parent | 5447510256e5a1b371407b751ddcc461044da5df (diff) | |
parent | a18ff9886771c41186eebf8d7984fee2120dbe36 (diff) | |
download | emacs-64e9342958694825be1664890dcd22fffcd50d3a.tar.gz emacs-64e9342958694825be1664890dcd22fffcd50d3a.tar.bz2 emacs-64e9342958694825be1664890dcd22fffcd50d3a.zip |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-53
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 302-319)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 69)
- Update from CVS
Diffstat (limited to 'lisp/emacs-lisp/copyright.el')
-rw-r--r-- | lisp/emacs-lisp/copyright.el | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index d0ceaa96716..0b46912c8fd 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el @@ -183,32 +183,36 @@ Uses heuristic: year >= 50 means 19xx, < 50 means 20xx." (widen) (goto-char (point-min)) (if (re-search-forward copyright-regexp (+ (point) copyright-limit) t) - (let ((s (match-beginning 2)) (e (make-marker)) + (let ((s (match-beginning 2)) + (e (copy-marker (1+ (match-end 2)))) + (p (make-marker)) last) - (set-marker e (1+ (match-end 2))) (goto-char s) - (while (and (< (point) (marker-position e)) - (re-search-forward "\\([^0-9]\\)\\([0-9]+\\)[^0-9]" - (marker-position e) t)) - (let ((p (point)) - (sep (match-string 1)) - (year (string-to-number (match-string 2)))) - (goto-char (1+ (match-beginning 0))) - (unless (= (char-syntax (string-to-char sep)) ?\s) + (while (re-search-forward "[0-9]+" e t) + (set-marker p (point)) + (goto-char (match-beginning 0)) + (let ((sep (char-before)) + (year (string-to-number (match-string 0)))) + (when (and sep + (/= (char-syntax sep) ?\s) + (/= sep ?-)) (insert " ")) - (if (< year 100) - (insert (if (>= year 50) "19" "20"))) - (goto-char p) - (setq last p))) + (when (< year 100) + (insert (if (>= year 50) "19" "20")))) + (goto-char p) + (setq last p)) (when last (goto-char last) - (let ((fill-prefix " ")) - (fill-region s last)) - ) + ;; Don't mess up whitespace after the years. + (skip-chars-backward " \t") + (save-restriction + (narrow-to-region (point-min) (point)) + (let ((fill-prefix " ")) + (fill-region s last)))) (set-marker e nil) + (set-marker p nil) (copyright-update nil t)) - (message "No copyright message") - (goto-char (point-min)))) + (message "No copyright message"))) ;;;###autoload (define-skeleton copyright |