From ed18d08f6f3041e6fd1806690c24ca6b31deab2d Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 26 Jan 2022 14:53:07 +0100 Subject: [PATCH] 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. --- lisp/emacs-lisp/copyright.el | 2 +- test/lisp/emacs-lisp/copyright-tests.el | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index 09c6ded2950..23b90808d90 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el @@ -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))))) diff --git a/test/lisp/emacs-lisp/copyright-tests.el b/test/lisp/emacs-lisp/copyright-tests.el index dc82974a99e..120cd5a6b5e 100644 --- a/test/lisp/emacs-lisp/copyright-tests.el +++ b/test/lisp/emacs-lisp/copyright-tests.el @@ -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 -- 2.39.2