Mercurial > emacs
comparison lisp/emacs-lisp/copyright.el @ 112431:7a578da192b9
Tweak previous copyright.el change.
* lisp/emacs-lisp/copyright.el (copyright-find-copyright)
(copyright-update, copyright-fix-years):
Do the initial widen and move in copyright-find-copyright.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 22 Jan 2011 14:18:01 -0800 |
parents | 78c4c9559156 |
children |
comparison
equal
deleted
inserted
replaced
112430:78c4c9559156 | 112431:7a578da192b9 |
---|---|
123 | 123 |
124 (defun copyright-find-copyright () | 124 (defun copyright-find-copyright () |
125 "Return non-nil if a copyright header suitable for updating is found. | 125 "Return non-nil if a copyright header suitable for updating is found. |
126 The header must match `copyright-regexp' and `copyright-names-regexp', if set. | 126 The header must match `copyright-regexp' and `copyright-names-regexp', if set. |
127 This function sets the match-data that `copyright-update-year' uses." | 127 This function sets the match-data that `copyright-update-year' uses." |
128 (widen) | |
129 (goto-char (copyright-start-point)) | |
128 (condition-case err | 130 (condition-case err |
129 ;; (1) Need the extra \\( \\) around copyright-regexp because we | 131 ;; (1) Need the extra \\( \\) around copyright-regexp because we |
130 ;; goto (match-end 1) below. See note (2) below. | 132 ;; goto (match-end 1) below. See note (2) below. |
131 (copyright-re-search (concat "\\(" copyright-regexp | 133 (copyright-re-search (concat "\\(" copyright-regexp |
132 "\\)\\([ \t]*\n\\)?.*\\(?:" | 134 "\\)\\([ \t]*\n\\)?.*\\(?:" |
212 (when (or copyright-update interactivep) | 214 (when (or copyright-update interactivep) |
213 (let ((noquery (or (not copyright-query) | 215 (let ((noquery (or (not copyright-query) |
214 (and (eq copyright-query 'function) interactivep)))) | 216 (and (eq copyright-query 'function) interactivep)))) |
215 (save-excursion | 217 (save-excursion |
216 (save-restriction | 218 (save-restriction |
217 (widen) | |
218 (goto-char (copyright-start-point)) | |
219 ;; If names-regexp doesn't match, we should not mess with | 219 ;; If names-regexp doesn't match, we should not mess with |
220 ;; the years _or_ the GPL version. | 220 ;; the years _or_ the GPL version. |
221 (when (copyright-find-copyright) | 221 (when (copyright-find-copyright) |
222 (copyright-update-year arg noquery) | 222 (copyright-update-year arg noquery) |
223 (goto-char (copyright-start-point)) | 223 (goto-char (copyright-start-point)) |
251 ;;;###autoload | 251 ;;;###autoload |
252 (defun copyright-fix-years () | 252 (defun copyright-fix-years () |
253 "Convert 2 digit years to 4 digit years. | 253 "Convert 2 digit years to 4 digit years. |
254 Uses heuristic: year >= 50 means 19xx, < 50 means 20xx." | 254 Uses heuristic: year >= 50 means 19xx, < 50 means 20xx." |
255 (interactive) | 255 (interactive) |
256 (widen) | |
257 (goto-char (copyright-start-point)) | |
258 (if (copyright-find-copyright) | 256 (if (copyright-find-copyright) |
259 (let ((s (match-beginning 2)) | 257 (let ((s (match-beginning 2)) |
260 (e (copy-marker (1+ (match-end 2)))) | 258 (e (copy-marker (1+ (match-end 2)))) |
261 (p (make-marker)) | 259 (p (make-marker)) |
262 last) | 260 last) |