summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/copyright.el
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2021-07-25 23:34:55 +0900
committerYuuki Harano <masm+github@masm11.me>2021-07-25 23:34:55 +0900
commit13a9a5e836cbe6e64aadaba40fe1f7eb83320d08 (patch)
tree242ac1f485cf6762680a904952747d63b295e198 /lisp/emacs-lisp/copyright.el
parentb242394f24b154f8e20f5abf4b2f826629e99ea6 (diff)
parent41a55a330f518254da795719ac6e3085254d4110 (diff)
downloademacs-13a9a5e836cbe6e64aadaba40fe1f7eb83320d08.tar.gz
emacs-13a9a5e836cbe6e64aadaba40fe1f7eb83320d08.tar.bz2
emacs-13a9a5e836cbe6e64aadaba40fe1f7eb83320d08.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'lisp/emacs-lisp/copyright.el')
-rw-r--r--lisp/emacs-lisp/copyright.el15
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."
(with-demoted-errors "Can't update copyright: %s"
;; (1) Need the extra \\( \\) around copyright-regexp because we
;; goto (match-end 1) below. See note (2) below.
- (copyright-re-search (concat "\\(" copyright-regexp
- "\\)\\([ \t]*\n\\)?.*\\(?:"
- copyright-names-regexp "\\)")
- (copyright-limit)
- t)))
+ (let ((regexp (concat "\\(" copyright-regexp
+ "\\)\\([ \t]*\n\\)?.*\\(?:"
+ copyright-names-regexp "\\)")))
+ (when (copyright-re-search regexp (copyright-limit) t)
+ ;; We may accidentally have landed in the middle of a
+ ;; copyright line, so re-perform the search without the
+ ;; search. (Otherwise we may be inserting the new year in the
+ ;; middle of the list of years.)
+ (goto-char (match-beginning 0))
+ (copyright-re-search regexp nil t)))))
(defun copyright-find-end ()
"Possibly adjust the search performed by `copyright-find-copyright'.