mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-26 07:11:34 -08: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:
parent
7eca80b204
commit
ed18d08f6f
2 changed files with 12 additions and 1 deletions
|
|
@ -150,7 +150,7 @@ This function sets the match data that `copyright-update-year' uses."
|
||||||
(when (copyright-re-search regexp (copyright-limit) t)
|
(when (copyright-re-search regexp (copyright-limit) t)
|
||||||
;; We may accidentally have landed in the middle of a
|
;; We may accidentally have landed in the middle of a
|
||||||
;; copyright line, so re-perform the search without the
|
;; 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.)
|
;; middle of the list of years.)
|
||||||
(goto-char (match-beginning 0))
|
(goto-char (match-beginning 0))
|
||||||
(copyright-re-search regexp nil t)))))
|
(copyright-re-search regexp nil t)))))
|
||||||
|
|
|
||||||
|
|
@ -50,5 +50,16 @@
|
||||||
(dolist (test copyright-tests--data)
|
(dolist (test copyright-tests--data)
|
||||||
(with-copyright-test (car test) (cdr test))))
|
(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)
|
(provide 'copyright-tests)
|
||||||
;;; copyright-tests.el ends here
|
;;; copyright-tests.el ends here
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue