diff options
author | Richard M. Stallman <rms@gnu.org> | 2005-05-15 22:03:16 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2005-05-15 22:03:16 +0000 |
commit | 02d9d6829acce2f27a38ea9f14515f74aab138f8 (patch) | |
tree | bafeefdc1485f9af9d8bda344c0e0cd0430b389f /lisp/emacs-lisp/copyright.el | |
parent | c232fd12ab92e3a73b3d9b222540aefb9f4589a2 (diff) | |
download | emacs-02d9d6829acce2f27a38ea9f14515f74aab138f8.tar.gz |
(copyright-fix-years): Match properly if the first year is 2-digit.
Don't mess up the whitespace after the years by filling.
Diffstat (limited to 'lisp/emacs-lisp/copyright.el')
-rw-r--r-- | lisp/emacs-lisp/copyright.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index c2d3303c825..30c76b8769a 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el @@ -189,6 +189,8 @@ Uses heuristic: year >= 50 means 19xx, < 50 means 20xx." last) (set-marker e (1+ (match-end 2))) (goto-char s) + ;; Back up one character so that our search can match the first year. + (backward-char 1) (while (and (< (point) (marker-position e)) (re-search-forward "\\([^0-9]\\)\\([0-9]+\\)[^0-9]" (marker-position e) t)) @@ -204,8 +206,12 @@ Uses heuristic: year >= 50 means 19xx, < 50 means 20xx." (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) (copyright-update nil t)) |