diff options
| author | Lars Ingebrigtsen | 2021-07-18 14:31:09 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-07-18 14:31:09 +0200 |
| commit | 5ade22c2f89f85883232875c63fda70bb0a75c0d (patch) | |
| tree | 8aa250c68fffc22a2f37ef004bc61af687c6f6e1 | |
| parent | 90029c9dbea0a815c228369b85806f7daed9cfab (diff) | |
| download | emacs-5ade22c2f89f85883232875c63fda70bb0a75c0d.tar.gz emacs-5ade22c2f89f85883232875c63fda70bb0a75c0d.zip | |
Fix an unlikely `copyright-find-copyright' problem
* lisp/emacs-lisp/copyright.el (copyright-find-copyright): Make
the copyright matcher more robust (bug#7179).
| -rw-r--r-- | lisp/emacs-lisp/copyright.el | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index 6ba2e7804bb..d2e4891acee 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el | |||
| @@ -144,11 +144,16 @@ This function sets the match-data that `copyright-update-year' uses." | |||
| 144 | (with-demoted-errors "Can't update copyright: %s" | 144 | (with-demoted-errors "Can't update copyright: %s" |
| 145 | ;; (1) Need the extra \\( \\) around copyright-regexp because we | 145 | ;; (1) Need the extra \\( \\) around copyright-regexp because we |
| 146 | ;; goto (match-end 1) below. See note (2) below. | 146 | ;; goto (match-end 1) below. See note (2) below. |
| 147 | (copyright-re-search (concat "\\(" copyright-regexp | 147 | (let ((regexp (concat "\\(" copyright-regexp |
| 148 | "\\)\\([ \t]*\n\\)?.*\\(?:" | 148 | "\\)\\([ \t]*\n\\)?.*\\(?:" |
| 149 | copyright-names-regexp "\\)") | 149 | copyright-names-regexp "\\)"))) |
| 150 | (copyright-limit) | 150 | (when (copyright-re-search regexp (copyright-limit) t) |
| 151 | t))) | 151 | ;; We may accidentally have landed in the middle of a |
| 152 | ;; copyright line, so re-perform the search without the | ||
| 153 | ;; search. (Otherwise we may be inserting the new year in the | ||
| 154 | ;; middle of the list of years.) | ||
| 155 | (goto-char (match-beginning 0)) | ||
| 156 | (copyright-re-search regexp nil t))))) | ||
| 152 | 157 | ||
| 153 | (defun copyright-find-end () | 158 | (defun copyright-find-end () |
| 154 | "Possibly adjust the search performed by `copyright-find-copyright'. | 159 | "Possibly adjust the search performed by `copyright-find-copyright'. |