1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-03 08:30:09 +00:00

Fix copyright.el comment and add a test

* lisp/emacs-lisp/copyright.el (copyright-find-copyright): Fix
comment (bug#7179).

Do not merge to master.
This commit is contained in:
Lars Ingebrigtsen 2022-01-26 14:53:07 +01:00
parent 7eca80b204
commit ed18d08f6f
2 changed files with 12 additions and 1 deletions

View File

@ -150,7 +150,7 @@ This function sets the match data that `copyright-update-year' uses."
(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
;; limit. (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)))))

View File

@ -50,5 +50,16 @@
(dolist (test copyright-tests--data)
(with-copyright-test (car test) (cdr test))))
(ert-deftest test-end-chop ()
(should
(equal
(with-temp-buffer
(let ((copyright-query nil))
(insert (make-string (- copyright-limit 14) ?x) "\n"
"\nCopyright 2006, 2007, 2008 Foo Bar\n\n")
(copyright-update)
(buffer-substring (- (point-max) 42) (point-max))))
"Copyright 2006, 2007, 2008, 2022 Foo Bar\n\n")))
(provide 'copyright-tests)
;;; copyright-tests.el ends here