Mercurial > emacs
comparison lisp/emacs-lisp/copyright.el @ 109786:29d15cb50113
Save window excursion before prompting in copyright-update-* (Bug#5394).
* emacs-lisp/copyright.el (copyright-update-year)
(copyright-update): Use save-window-excursion (Bug#5394).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 14 Aug 2010 19:30:51 -0400 |
parents | 1d1d5d9bd884 |
children | 417b1e4d63cd |
comparison
equal
deleted
inserted
replaced
109785:de5d6a3f1493 | 109786:29d15cb50113 |
---|---|
156 ;; Note that `current-time-string' isn't locale-sensitive. | 156 ;; Note that `current-time-string' isn't locale-sensitive. |
157 (setq copyright-current-year (substring (current-time-string) -4)) | 157 (setq copyright-current-year (substring (current-time-string) -4)) |
158 (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3)) | 158 (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3)) |
159 (substring copyright-current-year -2)) | 159 (substring copyright-current-year -2)) |
160 (if (or noquery | 160 (if (or noquery |
161 ;; Fixes some point-moving oddness (bug#2209). | 161 (save-window-excursion |
162 (save-excursion | 162 (switch-to-buffer (current-buffer)) |
163 (y-or-n-p (if replace | 163 ;; Fixes some point-moving oddness (bug#2209). |
164 (concat "Replace copyright year(s) by " | 164 (save-excursion |
165 copyright-current-year "? ") | 165 (y-or-n-p (if replace |
166 (concat "Add " copyright-current-year | 166 (concat "Replace copyright year(s) by " |
167 " to copyright? "))))) | 167 copyright-current-year "? ") |
168 (concat "Add " copyright-current-year | |
169 " to copyright? ")))))) | |
168 (if replace | 170 (if replace |
169 (replace-match copyright-current-year t t nil 3) | 171 (replace-match copyright-current-year t t nil 3) |
170 (let ((size (save-excursion (skip-chars-backward "0-9")))) | 172 (let ((size (save-excursion (skip-chars-backward "0-9")))) |
171 (if (and (eq (% (- (string-to-number copyright-current-year) | 173 (if (and (eq (% (- (string-to-number copyright-current-year) |
172 (string-to-number (buffer-substring | 174 (string-to-number (buffer-substring |
222 ;; version than the "current" one. | 224 ;; version than the "current" one. |
223 (< (string-to-number (match-string 3)) | 225 (< (string-to-number (match-string 3)) |
224 (string-to-number copyright-current-gpl-version)) | 226 (string-to-number copyright-current-gpl-version)) |
225 (or noquery | 227 (or noquery |
226 (save-match-data | 228 (save-match-data |
227 (y-or-n-p (format "Replace GPL version by %s? " | 229 (save-window-excursion |
228 copyright-current-gpl-version)))) | 230 (switch-to-buffer (current-buffer)) |
231 (y-or-n-p (format "Replace GPL version by %s? " | |
232 copyright-current-gpl-version))))) | |
229 (progn | 233 (progn |
230 (if (match-end 2) | 234 (if (match-end 2) |
231 ;; Esperanto bilingual comment in two-column.el | 235 ;; Esperanto bilingual comment in two-column.el |
232 (replace-match copyright-current-gpl-version t t nil 2)) | 236 (replace-match copyright-current-gpl-version t t nil 2)) |
233 (replace-match copyright-current-gpl-version t t nil 3)))) | 237 (replace-match copyright-current-gpl-version t t nil 3)))) |